diff --git a/content/posts/how-i-convert-pdfs-to-epub.adoc b/content/posts/how-i-convert-pdfs-to-epub.adoc index 832dfba..dad97c6 100644 --- a/content/posts/how-i-convert-pdfs-to-epub.adoc +++ b/content/posts/how-i-convert-pdfs-to-epub.adoc @@ -20,6 +20,9 @@ toc: true :url-calibre-convert: https://manual.calibre-ebook.com/conversion.html#pdfconversion :url-emacs: https://www.gnu.org/software/emacs/ :url-emacs-key-notation: https://www.emacswiki.org/emacs/EmacsKeyNotation +:url-helicon-type: https://www.heliconbooks.com/?id=blog&postid=EPUB3Footnotes +:url-epub-spec: https://www.w3.org/publishing/epub/epub-contentdocs.html +:url-ap-semantics: https://www.accessiblepublishing.ca/epub-semantic-aria-roles/ :wp-pdf: https://en.wikipedia.org/wiki/PDF :wp-epub: https://en.wikipedia.org/wiki/EPUB :wp-xhtml: https://en.wikipedia.org/wiki/XHTML @@ -68,7 +71,7 @@ Your files should look similar to this: [source,html] -------------------------------------------------------------------------------- - + Meine zwei Jahre in Russland @@ -175,20 +178,21 @@ elisp function: Once you are done, copy the result into Calibre. -== Add footnotes +[#_add_footnotes] +== Add endnotes -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 +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 hyperlink-able, so we can't just wrap them in plain `

` tags, they need IDs. I -like to use `1

[…]

` if there is only one -footnote-section or `1

[…]

` for -chapter-footnotes. 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 `1` if there +is only one footnote-section or `1` 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: `` kbd:[C-x] kbd:[C-k] kbd:[] kbd:[C-u] `-1` kbd:[C-x] kbd:[C-k] -kbd:[C-a] `

` kbd:[] -`

` kbd:[] kbd:[] kbd:[] +kbd:[C-a] `` kbd:[] kbd:[] kbd:[] [NOTE] kbd:[C-u] `-1` kbd:[C-x] kbd:[C-k] kbd:[C-a] “adds” -1 to the counter, so that @@ -200,7 +204,8 @@ out what a key combination does. Call the macro until every footnote is wrapped and copy them to Calibre. -=== Add references to footnotes +[#_add_references_to_footnotes] +=== Add references to endnotes 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 @@ -208,7 +213,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: `` ([0-9]{1,3})([ <])`` (note the leading space) + -Replace: `\1\2` +Replace: `\1\2` Press kbd:[] to search through the text and kbd:[C-r] to replace. @@ -225,5 +230,12 @@ Select menu:Tools[Check book] and fix the errors. You're done! Enjoy your cleanly formatted book. 😊 +== Updates + +* [2021-02-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. // LocalWords: Calibre