Fix footnotes starting with empty line
This commit is contained in:
parent
3c2e9ed204
commit
d5665fb21c
5 changed files with 26 additions and 11 deletions
12
org/org.go
12
org/org.go
|
@ -148,8 +148,18 @@ func (w *OrgWriter) writeFootnotes(d *Document) {
|
|||
}
|
||||
}
|
||||
|
||||
func isEmptyLineParagraph(n Node) bool {
|
||||
if p, _ := n.(Paragraph); len(p.Children) == 1 {
|
||||
return len(p.Children[0].(Line).Children) == 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (w *OrgWriter) writeFootnoteDefinition(f FootnoteDefinition) {
|
||||
w.WriteString(fmt.Sprintf("[fn:%s] ", f.Name))
|
||||
w.WriteString(fmt.Sprintf("[fn:%s]", f.Name))
|
||||
if !(len(f.Children) >= 1 && isEmptyLineParagraph(f.Children[0])) {
|
||||
w.WriteString(" ")
|
||||
}
|
||||
w.writeNodes(f.Children...)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue