Refactor Footnotes: Exclude footnotes heading during export, not parsing
Until now the footnotes section was parsed but not included in the resulting AST - his required rebuilding it in the OrgWriter. It feels cleaner to include it in the AST and only exclude it in the export
This commit is contained in:
parent
ced166dc18
commit
ac2597af4c
5 changed files with 17 additions and 31 deletions
|
@ -5,10 +5,9 @@ import (
|
|||
)
|
||||
|
||||
type Footnotes struct {
|
||||
ExcludeHeading bool
|
||||
Title string
|
||||
Definitions map[string]*FootnoteDefinition
|
||||
addOrder []string
|
||||
Title string
|
||||
Definitions map[string]*FootnoteDefinition
|
||||
addOrder []string
|
||||
}
|
||||
|
||||
type FootnoteDefinition struct {
|
||||
|
@ -35,8 +34,9 @@ func (d *Document) parseFootnoteDefinition(i int, parentStop stopFn) (int, Node)
|
|||
d.tokens[i].kind == "headline" || d.tokens[i].kind == "footnoteDefinition"
|
||||
}
|
||||
consumed, nodes := d.parseMany(i, stop)
|
||||
d.Footnotes.add(name, &FootnoteDefinition{name, nodes, false})
|
||||
return consumed, nil
|
||||
definition := FootnoteDefinition{name, nodes, false}
|
||||
d.Footnotes.add(name, &definition)
|
||||
return consumed, definition
|
||||
}
|
||||
|
||||
func (fs *Footnotes) add(name string, definition *FootnoteDefinition) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue