Fix BufferSettings append & add ParseFrontMatter
until now buffersettings were always appended using \n which means the first value would already be written as "\nVALUE". Not anymore. Also we finally add an option to parse just the front matter. Still not efficient as we tokenize the whole org file but i don't think saving a few milliseconds would be worth making the code uglier.
This commit is contained in:
parent
0255a129e2
commit
a0e87057d6
3 changed files with 110 additions and 4 deletions
|
@ -47,7 +47,11 @@ func (d *Document) parseKeyword(i int, stop stopFn) (int, Node) {
|
|||
return consumed, node
|
||||
}
|
||||
}
|
||||
d.BufferSettings[k.Key] = strings.Join([]string{d.BufferSettings[k.Key], k.Value}, "\n")
|
||||
if _, ok := d.BufferSettings[k.Key]; ok {
|
||||
d.BufferSettings[k.Key] = strings.Join([]string{d.BufferSettings[k.Key], k.Value}, "\n")
|
||||
} else {
|
||||
d.BufferSettings[k.Key] = k.Value
|
||||
}
|
||||
return 1, k
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue