Refactor footnote handling
- Remove unused footnote section title option - Move away from maintaining a list of footnotes in the document (only needed for html export, potential maintainance overhead when modifying the document) and rather only build it on export when required. - HTML export: Rename all footnotes to numbers (so we can support anonymous footnote references by assigning them a number) and export footnotes in order of reference, not definition. The implementation of this makes it natural to also stop exporting unused footnote definitions so we do that as well.
This commit is contained in:
parent
50395f999a
commit
6dc04b4b02
8 changed files with 69 additions and 100 deletions
66
org/testdata/footnotes.html
vendored
66
org/testdata/footnotes.html
vendored
|
@ -12,12 +12,12 @@ Using some footnotes
|
|||
<ul>
|
||||
<li>
|
||||
<p>
|
||||
normal footnote reference <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> <sup class="footnote-reference"><a id="footnote-reference-6" href="#footnote-6">6</a></sup>
|
||||
normal footnote reference <sup class="footnote-reference"><a id="footnote-reference-0" href="#footnote-0">0</a></sup> <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup>
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
further references to the same footnote should not <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> render duplicates in the footnote list
|
||||
further references to the same footnote should not <sup class="footnote-reference"><a id="footnote-reference-0" href="#footnote-0">0</a></sup> render duplicates in the footnote list
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -28,7 +28,7 @@ inline footnotes are also supported via <sup class="footnote-reference"><a id="f
|
|||
<li>
|
||||
<p>
|
||||
Footnote definitions are not printed where they appear.
|
||||
Rather, they are gathered and exported at the end of the document in the footnote section. <sup class="footnote-reference"><a id="footnote-reference-4" href="#footnote-4">4</a></sup>
|
||||
Rather, they are gathered and exported at the end of the document in the footnote section. <sup class="footnote-reference"><a id="footnote-reference-3" href="#footnote-3">3</a></sup>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -36,33 +36,16 @@ Rather, they are gathered and exported at the end of the document in the footnot
|
|||
Footnotes
|
||||
</h1>
|
||||
<p>
|
||||
Please note that the footnotes section is not automatically excluded from the export like in emacs. <sup class="footnote-reference"><a id="footnote-reference-7" href="#footnote-7">7</a></sup>
|
||||
Please note that the footnotes section is not automatically excluded from the export like in emacs. <sup class="footnote-reference"><a id="footnote-reference-4" href="#footnote-4">4</a></sup>
|
||||
</p>
|
||||
<p>
|
||||
this is not part of <sup class="footnote-reference"><a id="footnote-reference-7" href="#footnote-7">7</a></sup> anymore as there are 2 blank lines in between!
|
||||
this is not part of <sup class="footnote-reference"><a id="footnote-reference-4" href="#footnote-4">4</a></sup> anymore as there are 2 blank lines in between!
|
||||
</p>
|
||||
<div class="footnotes">
|
||||
<hr class="footnotes-separatator">
|
||||
<div class="footnote-definitions">
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-4"><a href="#footnote-reference-4">4</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
so this definition will not be at the end of this section in the exported document.
|
||||
Rather, it will be somewhere down below in the footnotes section.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-5"><a href="#footnote-reference-5">5</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
another unused footnote (this definition overwrites the previous definition of <code class="verbatim">fn:5</code>)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>
|
||||
<sup id="footnote-0"><a href="#footnote-reference-0">0</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
<a href="https://www.example.com">https://www.example.com</a>
|
||||
|
@ -115,15 +98,7 @@ and tables
|
|||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-3"><a href="#footnote-reference-3">3</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
<a href="http://example.com/unused-footnote">example.com/unused-footnote</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-6"><a href="#footnote-reference-6">6</a></sup>
|
||||
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
Footnotes break after two consecutive empty lines - just like paragraphs - see <a href="https://orgmode.org/worg/dev/org-syntax.html.">https://orgmode.org/worg/dev/org-syntax.html.</a>
|
||||
|
@ -132,15 +107,6 @@ This shouldn't happen when the definition line and the line after that are e
|
|||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-7"><a href="#footnote-reference-7">7</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
There's multiple reasons for that. Among others, doing so requires i18n (to recognize the section) and silently
|
||||
hides content before and after the footnotes.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-2"><a href="#footnote-reference-2">2</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
|
@ -148,5 +114,23 @@ the inline footnote definition
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-3"><a href="#footnote-reference-3">3</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
so this definition will not be at the end of this section in the exported document.
|
||||
Rather, it will be somewhere down below in the footnotes section.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-4"><a href="#footnote-reference-4">4</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
There's multiple reasons for that. Among others, doing so requires i18n (to recognize the section) and silently
|
||||
hides content before and after the footnotes.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
6
org/testdata/misc.html
vendored
6
org/testdata/misc.html
vendored
|
@ -409,7 +409,7 @@ src/example/export blocks should not be converted!
|
|||
<a href="https://github.com/chaseadamsio/goorgeous/issues/87">#87</a>: Markup in footnotes is rendered literally
|
||||
</h3>
|
||||
<p>
|
||||
footnotes can contain <strong>markup</strong> - and other elements and stuff <sup class="footnote-reference"><a id="footnote-reference-2" href="#footnote-2">2</a></sup>
|
||||
footnotes can contain <strong>markup</strong> - and other elements and stuff <sup class="footnote-reference"><a id="footnote-reference-0" href="#footnote-0">0</a></sup> <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup>
|
||||
</p>
|
||||
<h3 id="headline-23">
|
||||
<span class="todo">DONE</span>
|
||||
|
@ -472,7 +472,7 @@ Footnotes
|
|||
<hr class="footnotes-separatator">
|
||||
<div class="footnote-definitions">
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>
|
||||
<sup id="footnote-0"><a href="#footnote-reference-0">0</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
a footnote <em>with</em> <strong>markup</strong>
|
||||
|
@ -492,7 +492,7 @@ because that's possible
|
|||
</div>
|
||||
</div>
|
||||
<div class="footnote-definition">
|
||||
<sup id="footnote-2"><a href="#footnote-reference-2">2</a></sup>
|
||||
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>
|
||||
<div class="footnote-body">
|
||||
<p>
|
||||
that also goes for <strong>inline</strong> footnote <em>definitions</em>
|
||||
|
|
2
org/testdata/misc.org
vendored
2
org/testdata/misc.org
vendored
|
@ -108,7 +108,7 @@ also, consecutive dashes inside
|
|||
: --, ---
|
||||
|
||||
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/87][#87]]: Markup in footnotes is rendered literally
|
||||
footnotes can contain *markup* - and other elements and stuff [fn:2:that also goes for *inline* footnote /definitions/]
|
||||
footnotes can contain *markup* - and other elements and stuff [fn:1] [fn:2:that also goes for *inline* footnote /definitions/]
|
||||
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/92][#92]]: src blocks only render in caps
|
||||
The behaviour of Org mode =<s TAB= changed and it now inserts lowercased src blocks (go-org already handled this one)
|
||||
- lowercased:
|
||||
|
|
2
org/testdata/misc.pretty_org
vendored
2
org/testdata/misc.pretty_org
vendored
|
@ -108,7 +108,7 @@ also, consecutive dashes inside
|
|||
: --, ---
|
||||
|
||||
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/87][#87]]: Markup in footnotes is rendered literally
|
||||
footnotes can contain *markup* - and other elements and stuff [fn:2:that also goes for *inline* footnote /definitions/]
|
||||
footnotes can contain *markup* - and other elements and stuff [fn:1] [fn:2:that also goes for *inline* footnote /definitions/]
|
||||
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/92][#92]]: src blocks only render in caps
|
||||
The behaviour of Org mode =<s TAB= changed and it now inserts lowercased src blocks (go-org already handled this one)
|
||||
- lowercased:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue