PDF→EPUB: Clarified difference between footnotes and endnotes,

replaced `<span><aside>` with `<li>`.
This commit is contained in:
tastytea 2021-03-25 18:24:48 +01:00
parent 8bd0e60aae
commit b56cf6c52b
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 26 additions and 23 deletions

View File

@ -178,36 +178,37 @@ elisp function:
Once you are done, copy the result into Calibre.
[#_add_footnotes]
== Add endnotes
== Add footnotes
Use the method from above to copy the endnotes into the now empty Emacs buffer
and clean them up until you have 1 paragraph per line. Endnotes need to be
Use the method from above to copy the footnotes into the now empty Emacs buffer
and clean them up until you have 1 paragraph per line. Footnotes need to be
hyperlink-able, so we can't just wrap them in plain `<p>` tags, they need IDs. I
like to use `<span>1</span><aside epub:type="endnote" role="doc-endnote"
id="fn1">[…]</aside>` if there is only one footnote-section or
`<span>1</span><aside epub:type="endnote" role="doc-endnote"
id="fn1_1">[…]</aside>` for chapter-endnotes. We are going to use a macro with a
counter to generate consecutively numbered IDs. First, set the counter to 1 with
kbd:[C-x] kbd:[C-k] kbd:[C-c] `1`. Then, record this macro:
like to use `<li epub:type="footnote" role="doc-footnote" id="fn1">[…]</li>` if
the footnote numbers are increasing throughout the book or `<li
epub:type="footnote" role="doc-footnote" id="fn1_1">[…]</li>` if they start with
1 in each chapter. We are going to use a macro with a counter to generate
consecutively numbered IDs. First, set the counter to 1 with kbd:[C-x] kbd:[C-k]
kbd:[C-c] `1`. Then, record this macro:
`<span>` kbd:[C-x] kbd:[C-k] kbd:[<tab>] kbd:[C-u] `-1` kbd:[C-x] kbd:[C-k]
kbd:[C-a] `</span><aside epub:type="endnote" role="doc-endnote" id="fn`
kbd:[C-x] kbd:[C-k] kbd:[<tab>] `">` kbd:[<end>] `</aside>` kbd:[<down>]
kbd:[<down>] kbd:[<home>]
[NOTE]
kbd:[C-u] `-1` kbd:[C-x] kbd:[C-k] kbd:[C-a] “adds” -1 to the counter, so that
we can use the same number again.
`<li epub:type="footnote" role="doc-footnote" id="fn1_` kbd:[C-x] kbd:[C-k]
kbd:[<tab>] `">` kbd:[<end>] `</li>` kbd:[<down>] kbd:[<down>] kbd:[<home>]
[TIP]
Use kbd:[M-x] `describe-key` (mapped to kbd:[C-h] kbd:[k] by default) to find
out what a key combination does.
Call the macro until every footnote is wrapped and copy them to Calibre.
Call the macro until every footnote is wrapped and copy them to the end of the
chapter or the end of the book in Calibre. Wrap them in `<section
epub:type="footnotes" role="doc-footnotes"><ol>[…]</ol></section>`
[#_add_references_to_footnotes]
=== Add references to endnotes
[NOTE]
If the notes appear at the bottom of each page, they are called “footnotes”
(`epub:type="footnote"`). If they appear at the end of each chapter or the end
of the book, they are called “endnotes”. (`epub:type="endnote"`). The difference
is that some e-book readers display footnotes on the same page where the link
to them is even if you put all footnotes at the end of the chapter / book.
=== Add references to footnotes
The footnotes are probably superscript numbers in the PDF but normal numbers in
the EPUB right now. I found that the footnote-numbers are usually preceded by a
@ -215,7 +216,7 @@ space and followed by a space or `<`. I use the find & replace function in
Calibre in Regex-mode to convert them to hyperlinks.
Find: ``&nbsp;([0-9]{1,3})([ <])`` (note the leading space) +
Replace: `<sup><a epub:type="noteref" href="#fn\1">\1</a></sup>\2`
Replace: `<sup><a epub:type="noteref" href="#fn1_\1">\1</a></sup>\2`
Press kbd:[<f3>] to search through the text and kbd:[C-r] to replace.
@ -234,10 +235,12 @@ You're done! Enjoy your cleanly formatted book. 😊
== Updates
* [2021-02-21] Added ``epub:type``s to examples. See
* [2021-03-21] Added ``epub:type``s to examples. See
link:{url-helicon-type}[Helicon Books: Footnotes in EPUB3],
link:{url-epub-spec}#sec-epub-type-attribute[the EPUB specification] and
link:{url-ap-semantics}[AccessiblePublishing: EPUB Semantics, ARIA Roles, &
Metadata] for more information.
* [2021-03-25] Clarified difference between footnotes and endnotes, replaced
`<span><aside>` with `<li>`.
// LocalWords: Calibre