Fix inline footnote definition parsing
footnote definition descriptions are always elements - not just raw inline markup. we'll just wrap the description in a paragraph
This commit is contained in:
parent
d5bf4317b2
commit
0df8bc541b
2 changed files with 4 additions and 2 deletions
|
@ -116,7 +116,8 @@ func (d *Document) parseFootnoteReference(input string, start int) (int, Node) {
|
||||||
name, definition := m[1], m[3]
|
name, definition := m[1], m[3]
|
||||||
link := FootnoteLink{name, nil}
|
link := FootnoteLink{name, nil}
|
||||||
if definition != "" {
|
if definition != "" {
|
||||||
link.Definition = &FootnoteDefinition{name, d.parseInline(definition), true}
|
paragraph := Paragraph{[]Node{Line{d.parseInline(definition)}}}
|
||||||
|
link.Definition = &FootnoteDefinition{name, []Node{paragraph}, true}
|
||||||
}
|
}
|
||||||
d.Footnotes.add(name, link.Definition)
|
d.Footnotes.add(name, link.Definition)
|
||||||
return len(m[0]), link
|
return len(m[0]), link
|
||||||
|
|
|
@ -237,7 +237,8 @@ func (w *OrgWriter) writeFootnoteLink(l FootnoteLink) {
|
||||||
w.WriteString("[fn:" + l.Name)
|
w.WriteString("[fn:" + l.Name)
|
||||||
if l.Definition != nil {
|
if l.Definition != nil {
|
||||||
w.WriteString(":")
|
w.WriteString(":")
|
||||||
w.writeNodes(l.Definition.Children...)
|
line := l.Definition.Children[0].(Paragraph).Children[0].(Line)
|
||||||
|
w.writeNodes(line.Children...)
|
||||||
}
|
}
|
||||||
w.WriteString("]")
|
w.WriteString("]")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue