diff --git a/org/html.go b/org/html.go index b76e481..1db4ab4 100644 --- a/org/html.go +++ b/org/html.go @@ -134,10 +134,12 @@ func (w *HTMLWriter) writeBlock(b Block) { } func (w *HTMLWriter) writeFootnoteDefinition(f FootnoteDefinition) { + n := f.Name w.WriteString(`
` + "\n") - w.WriteString(fmt.Sprintf(`%s`, f.Name, f.Name) + "\n") + w.WriteString(fmt.Sprintf(`%s`, n, n, n) + "\n") + w.WriteString(`
` + "\n") w.writeNodes(f.Children...) - w.WriteString("
\n") + w.WriteString("
\n\n") } func (w *HTMLWriter) writeFootnotes(d *Document) { @@ -145,7 +147,7 @@ func (w *HTMLWriter) writeFootnotes(d *Document) { if len(fs.Definitions) == 0 { return } - w.WriteString(`
` + "\n") + w.WriteString(`
` + "\n") w.WriteString(`

` + fs.Title + `

` + "\n") w.WriteString(`
` + "\n") for _, definition := range d.Footnotes.Ordered() { @@ -180,9 +182,8 @@ func (w *HTMLWriter) writeLinebreak(l Linebreak) { } func (w *HTMLWriter) writeFootnoteLink(l FootnoteLink) { - name := html.EscapeString(l.Name) - w.WriteString(fmt.Sprintf(`%s`, name, name)) - + n := html.EscapeString(l.Name) + w.WriteString(fmt.Sprintf(`%s`, n, n, n)) } func (w *HTMLWriter) writeRegularLink(l RegularLink) { diff --git a/org/testdata/example.html b/org/testdata/example.html index 92a0b20..d44ada3 100644 --- a/org/testdata/example.html +++ b/org/testdata/example.html @@ -259,25 +259,26 @@ Bar paragraph
  • -normal footnote reference 1 6 +normal footnote reference 1 6

  • -further references to the same footnote should not 1 render duplicates in the footnote list +further references to the same footnote should not 1 render duplicates in the footnote list

  • -inline footnotes are also supported via 2. +inline footnotes are also supported via 2.

-
+

Footnotes

-1 +1 +

https://www.example.com

@@ -320,36 +321,47 @@ and tables
+
-4 +4 +

another unused footnote

+
-5 +5 +

another unused footnote

+
-6 +6 +

Footnotes break after two consecutive empty lines - just like paragraphs - see https://orgmode.org/worg/dev/org-syntax.html. This shouldn't happen when the definition line and the line after that are empty.

+
-2 +2 +

the inline footnote definition

+