HTML export: Improve handling of missing footnote definitions

This commit is contained in:
Niklas Fasching 2019-07-07 18:01:22 +02:00
parent 09c85c3e66
commit d154403f06
4 changed files with 20 additions and 3 deletions

View file

@ -151,6 +151,16 @@ 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 {
if definition == nil {
name := ""
for k, v := range w.footnotes.mapping {
if v == i {
name = k
}
}
w.log.Printf("Missing footnote definition for [fn:%s] (#%d)", name, i)
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(`<div class="footnote-body">` + "\n")