Handle malformed :PROPERTY: drawers
Until now we'd get index out of range errors trying to index into the match if :PROPERTIES: was followed by a non-property. Thanks fuzz
This commit is contained in:
parent
76b157b8ce
commit
adeeb9235d
5 changed files with 28 additions and 0 deletions
|
@ -67,6 +67,9 @@ func (d *Document) parsePropertyDrawer(i int, parentStop stopFn) (int, Node) {
|
|||
}
|
||||
for ; !stop(d, i); i++ {
|
||||
m := propertyRegexp.FindStringSubmatch(d.tokens[i].matches[0])
|
||||
if m == nil {
|
||||
return 0, nil
|
||||
}
|
||||
k, v := strings.ToUpper(m[2]), strings.TrimSpace(m[4])
|
||||
drawer.Properties = append(drawer.Properties, []string{k, v})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue