Add support for headline CUSTOM_ID property & linking

this introduces the PropertyDrawer node to make it easier to access the
properties associated to a headline - normal drawers don't parse their content
into kv pairs
This commit is contained in:
Niklas Fasching 2018-12-19 13:25:12 +01:00
parent ec895cbe83
commit aa42998dbc
8 changed files with 79 additions and 14 deletions

View file

@ -10,7 +10,7 @@ type Headline struct {
Lvl int
Status string
Priority string
Properties Node
Properties *PropertyDrawer
Title []Node
Tags []string
Children []Node
@ -62,8 +62,8 @@ func (d *Document) parseHeadline(i int, parentStop stopFn) (int, Node) {
}
consumed, nodes := d.parseMany(i+1, stop)
if len(nodes) > 0 {
if d, ok := nodes[0].(Drawer); ok && d.Name == "PROPERTIES" {
headline.Properties = d
if d, ok := nodes[0].(PropertyDrawer); ok {
headline.Properties = &d
nodes = nodes[1:]
}
}