HTML export: Update footnote numbering to start with 1
I went with 0 based numbering because it was easier but after looking at the results 0 based numbering looks bad to me... let's start with 1 like everyone else as it's just a few more lines of code.
This commit is contained in:
parent
d154403f06
commit
777899c803
3 changed files with 23 additions and 21 deletions
|
@ -151,6 +151,7 @@ func (w *HTMLWriter) WriteFootnotes(d *Document) {
|
|||
w.WriteString(`<hr class="footnotes-separatator">` + "\n")
|
||||
w.WriteString(`<div class="footnote-definitions">` + "\n")
|
||||
for i, definition := range w.footnotes.list {
|
||||
id := i + 1
|
||||
if definition == nil {
|
||||
name := ""
|
||||
for k, v := range w.footnotes.mapping {
|
||||
|
@ -158,11 +159,11 @@ func (w *HTMLWriter) WriteFootnotes(d *Document) {
|
|||
name = k
|
||||
}
|
||||
}
|
||||
w.log.Printf("Missing footnote definition for [fn:%s] (#%d)", name, i)
|
||||
w.log.Printf("Missing footnote definition for [fn:%s] (#%d)", name, id)
|
||||
continue
|
||||
}
|
||||
w.WriteString(`<div class="footnote-definition">` + "\n")
|
||||
w.WriteString(fmt.Sprintf(`<sup id="footnote-%d"><a href="#footnote-reference-%d">%d</a></sup>`, i, i, i) + "\n")
|
||||
w.WriteString(fmt.Sprintf(`<sup id="footnote-%d"><a href="#footnote-reference-%d">%d</a></sup>`, id, id, id) + "\n")
|
||||
w.WriteString(`<div class="footnote-body">` + "\n")
|
||||
WriteNodes(w, definition.Children...)
|
||||
w.WriteString("</div>\n</div>\n")
|
||||
|
@ -262,7 +263,8 @@ func (w *HTMLWriter) WriteFootnoteLink(l FootnoteLink) {
|
|||
if !w.document.GetOption("f") {
|
||||
return
|
||||
}
|
||||
id := w.footnotes.add(l)
|
||||
i := w.footnotes.add(l)
|
||||
id := i + 1
|
||||
w.WriteString(fmt.Sprintf(`<sup class="footnote-reference"><a id="footnote-reference-%d" href="#footnote-%d">%d</a></sup>`, id, id, id))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue