From 0df8bc541b9c6e198d5fbc8eef5736375753b2ef Mon Sep 17 00:00:00 2001 From: Niklas Fasching Date: Sun, 2 Dec 2018 23:26:24 +0100 Subject: [PATCH] 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 --- org/inline.go | 3 ++- org/org.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/org/inline.go b/org/inline.go index f891476..5cb65a9 100644 --- a/org/inline.go +++ b/org/inline.go @@ -116,7 +116,8 @@ func (d *Document) parseFootnoteReference(input string, start int) (int, Node) { name, definition := m[1], m[3] link := FootnoteLink{name, nil} 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) return len(m[0]), link diff --git a/org/org.go b/org/org.go index 15ae21b..e728b04 100644 --- a/org/org.go +++ b/org/org.go @@ -237,7 +237,8 @@ func (w *OrgWriter) writeFootnoteLink(l FootnoteLink) { w.WriteString("[fn:" + l.Name) if l.Definition != nil { w.WriteString(":") - w.writeNodes(l.Definition.Children...) + line := l.Definition.Children[0].(Paragraph).Children[0].(Line) + w.writeNodes(line.Children...) } w.WriteString("]") }