Improve footnote handling

- Footnotes separator rather than headline to get around i18n
- Warn on footnote redefinition
- Do not export footnote definitions at point of definition, only in the
  footnote section.
- Do not automatically exclude Footnotes section to get around possibly hiding
  other content of such a section - and i18n.
  The user has the choice of explicitly hiding the section via a :noexport:
  tag.

and some other refactoring
This commit is contained in:
Niklas Fasching 2018-12-26 15:23:23 +01:00
parent beff0c0d8a
commit eb7db9b968
11 changed files with 114 additions and 60 deletions

View file

@ -17,11 +17,43 @@ further references to the same footnote should not <sup class="footnote-referenc
inline footnotes are also supported via <sup class="footnote-reference"><a id="footnote-reference-2" href="#footnote-2">2</a></sup>.
</p>
</li>
<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>
</p>
</li>
</ul>
<h1>
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>
</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!
</p>
<div class="footnotes">
<h1 class="footnotes-title">Footnotes</h1>
<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>
<div class="footnote-body">
<p>
@ -83,22 +115,6 @@ and tables
</div>
</div>
<div class="footnote-definition">
<sup id="footnote-4"><a href="#footnote-reference-4">4</a></sup>
<div class="footnote-body">
<p>
another unused footnote
</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
</p>
</div>
</div>
<div class="footnote-definition">
<sup id="footnote-6"><a href="#footnote-reference-6">6</a></sup>
<div class="footnote-body">
<p>
@ -108,6 +124,15 @@ This shouldn&#39;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&#39;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>

View file

@ -2,8 +2,17 @@
- normal footnote reference [fn:1] [fn:6]
- further references to the same footnote should not [fn:1] render duplicates in the footnote list
- inline footnotes are also supported via [fn:2:the inline footnote definition].
- Footnote definitions are not printed where they appear.
Rather, they are gathered and exported at the end of the document in the footnote section. [fn:4]
[fn:4] 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.
[fn:5] this definition will also not be exported here - not only that, it will be overwritten by a definition
of the same name later on in the document. That will log a warning but carry on nonetheless.
* Footnotes
Please note that the footnotes section is not automatically excluded from the export like in emacs. [fn:7]
[fn:1] https://www.example.com
- footnotes can contain *markup*
- and other elements
@ -18,11 +27,18 @@
[fn:3] [[http://example.com/unused-footnote][example.com/unused-footnote]]
[fn:4] another unused footnote
[fn:5] another unused footnote
[fn:5] another unused footnote (this definition overwrites the previous definition of =fn:5=)
[fn: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.
[fn:7]
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.
this is not part of [fn:7] anymore as there are 2 blank lines in between!

View file

@ -2,8 +2,17 @@
- normal footnote reference [fn:1] [fn:6]
- further references to the same footnote should not [fn:1] render duplicates in the footnote list
- inline footnotes are also supported via [fn:2:the inline footnote definition].
- Footnote definitions are not printed where they appear.
Rather, they are gathered and exported at the end of the document in the footnote section. [fn:4]
[fn:4] 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.
[fn:5] this definition will also not be exported here - not only that, it will be overwritten by a definition
of the same name later on in the document. That will log a warning but carry on nonetheless.
* Footnotes
Please note that the footnotes section is not automatically excluded from the export like in emacs. [fn:7]
[fn:1] https://www.example.com
- footnotes can contain *markup*
- and other elements
@ -18,11 +27,18 @@
[fn:3] [[http://example.com/unused-footnote][example.com/unused-footnote]]
[fn:4] another unused footnote
[fn:5] another unused footnote
[fn:5] another unused footnote (this definition overwrites the previous definition of =fn:5=)
[fn: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.
[fn:7]
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.
this is not part of [fn:7] anymore as there are 2 blank lines in between!

View file

@ -359,8 +359,11 @@ When inserting an image link like <img src="/home/amos/Pictures/Screenshots/img-
(ansi-term))
</pre>
</div>
<h1>
Footnotes
</h1>
<div class="footnotes">
<h1 class="footnotes-title">Footnotes</h1>
<hr class="footnotes-separatator">
<div class="footnote-definitions">
<div class="footnote-definition">
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>