Support keywords without a value like "#+RESULTS:"

This commit is contained in:
Niklas Fasching 2018-12-11 15:54:40 +01:00
parent 9826aa2143
commit 04db858934

View file

@ -17,7 +17,7 @@ type NodeWithMeta struct {
type Comment struct{ Content string } type Comment struct{ Content string }
var keywordRegexp = regexp.MustCompile(`^(\s*)#\+([^:]+):\s(.*)`) var keywordRegexp = regexp.MustCompile(`^(\s*)#\+([^:]+):(\s+(.*)|(\s*)$)`)
var commentRegexp = regexp.MustCompile(`^(\s*)#(.*)`) var commentRegexp = regexp.MustCompile(`^(\s*)#(.*)`)
var affiliatedKeywordRegexp = regexp.MustCompile(`^(CAPTION)$`) var affiliatedKeywordRegexp = regexp.MustCompile(`^(CAPTION)$`)
@ -79,7 +79,7 @@ func (d *Document) parseAffiliated(i int, stop stopFn) (int, Node) {
} }
func parseKeyword(t token) Keyword { 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) k = strings.ToUpper(k)
return Keyword{k, v} return Keyword{k, v}
} }