From 04db8589349a05f5c41a148a0eb308ef8f20c1c3 Mon Sep 17 00:00:00 2001 From: Niklas Fasching Date: Tue, 11 Dec 2018 15:54:40 +0100 Subject: [PATCH] Support keywords without a value like "#+RESULTS:" --- org/keyword.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org/keyword.go b/org/keyword.go index fe27da5..cbb4829 100644 --- a/org/keyword.go +++ b/org/keyword.go @@ -17,7 +17,7 @@ type NodeWithMeta struct { type Comment struct{ Content string } -var keywordRegexp = regexp.MustCompile(`^(\s*)#\+([^:]+):\s(.*)`) +var keywordRegexp = regexp.MustCompile(`^(\s*)#\+([^:]+):(\s+(.*)|(\s*)$)`) var commentRegexp = regexp.MustCompile(`^(\s*)#(.*)`) var affiliatedKeywordRegexp = regexp.MustCompile(`^(CAPTION)$`) @@ -79,7 +79,7 @@ func (d *Document) parseAffiliated(i int, stop stopFn) (int, Node) { } func parseKeyword(t token) Keyword { - k, v := t.matches[2], t.matches[3] + k, v := t.matches[2], t.matches[4] k = strings.ToUpper(k) return Keyword{k, v} }