![]() |
#1 |
More Wiserer
![]() Posts: 9
Karma: 10
Join Date: Jan 2024
Device: Pocketbook Era (KOReader)
|
EPUB3 Footnote Fixer-Formatter
I recently discovered that you could read ebooks with the footnotes at the bottom of the page like in a real book (instead of a link to the end matter), and this lit my brain on fire. I've never seen this before, and it feels so obvious that it should just... be how it is for all books. This led me on a personal missing to convert all the footnotes for all of my ebooks into that properly formatted structure. I'm using KOReader as my ereader app of choice, and that's the one I'm testing with and want to make sure it works on.
Here's what I know so far. 1. The books have to be in EPUB3 2. The minimum effort required is to wrap the body of the footnote with an aside tag, like `<aside epub:type="footnote" id="[whatever the ID is]">` 3. This is complicated AF I have two scripts (ChatGPT wrote them and I provided feedback and logs) that attempt to wrap the body of the footnote text with `<aside epub:type="footnote" id="[whatever the ID is]">`. Unfortunately, the footnotes are formatted differently from book to book (even with the same author and publisher), and the scripts have not worked consistently for most books, or even consistently within a single book. For example, I bought 38 Terry Pratchett books from Humble Bundle. After converting the EPUB2 books to EPUB3, one of the scripts successfully converted around 20 books (although it left some nested footnotes that were not caught by the script), and the second script caught another 10 or so. In the end, there are 5 books that I have not been able to automatically convert. At this point, I think there are two options; fix the scripts so that they wrap the footnotes in the aside tag, OR create a new script that scrapes the footnote text and completely rebuilds the footnotes using a cleaner format. The new, cleaner format would look something like this: Code:
<!--Converting to single lines--> <!--Inline--> <p>This is some text that needs a footnote.<a href="FN_Section0001.xhtml#fn1" epub:type="noteref" id="bookfn1">[1]</a></p> <!-- Footnote content --> <body> <aside epub:type="footnote" id="fn1"> <p>This is the content of the footnote. <a href="9780061807145_Chapter_1_split_000.xhtml#bookfn1">↩</a></p> </aside> </body> If you want to take a look, I have the two python scripts available for review, as well as 70 ebooks (About 109 MB) with the copywritten information scrambled for script development and testing, linked here: Dropbox. If anyone has any ideas or suggestions, I'm all ears; as it is, I will keep posting here as I experiment and make progress. |
![]() |
![]() |
![]() |
#2 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,631
Karma: 103503445
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
What ereaders and apps have you tested it on?
|
![]() |
![]() |
![]() |
#3 |
More Wiserer
![]() Posts: 9
Karma: 10
Join Date: Jan 2024
Device: Pocketbook Era (KOReader)
|
I'm using a PocketBook Era with KOReader, and then ReadEra Premium on my android devices. The PocketBook reader app does not display the footnotes like KOReader or ReadEra do. I have not tried importing the modified EPUBs to Kobo or Kindle.
And just to clarify, the scrambled books are not currently functional; that said, I should probably scramble some of the ones I've updated for reference. |
![]() |
![]() |
![]() |
#4 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
|
I’ve recently updated KOReader on my PW3 to v2024 after using v2020 for the past four years and the .epub I’m working on, exported as EPUB 3 from InDesign (CC2019), has footnotes appearing at the bottom at the page, even though I'm not using <aside> (they’re exported as end-of-chapter endnotes). The other epubs I've checked don't do this; I've yet to check the code or the epub version of each.
|
![]() |
![]() |
![]() |
#5 | |
More Wiserer
![]() Posts: 9
Karma: 10
Join Date: Jan 2024
Device: Pocketbook Era (KOReader)
|
Quote:
Like I said, it's been really weird and inconsistent, and I'm sure part of my struggles have to do with converting EPUB2 to EPUB3 books (EPUB2 books not having the formatting options that EPUB3 books do). When I started this project, I had two functional points of reference; "A City on Mars" by Kelly and Zach Weinersmith (highly recommend), and the sample I shared in the original post (which is based on an old post I can't find, but also this one from Apple for its Pop-up Footnotes). I tried removing and adding elements to the books "Sourcery" and "Pyramids" by Terry Pratchett, and eventually landed on wrapping the footnote with the <aside> tag. Last edited by WiseGuru; 02-09-2024 at 01:05 PM. Reason: added link to the aside documentation from Apple. |
|
![]() |
![]() |
![]() |
#6 |
More Wiserer
![]() Posts: 9
Karma: 10
Join Date: Jan 2024
Device: Pocketbook Era (KOReader)
|
I somehow never came across this post here on mobileread by Tex2002ans which discusses the standardization of footnote formatting in EPUB3, and how certain devices display that information. It corroborates what I said earlier about the <aside> tag etc., though in my personal testing I also needed the footnote ID (e.g. <aside epub:type="footnote" id="note1") included for it to render properly on KOReader.
Also I forgot to mention, I'm using KOReader 2024.01 on my phone, and I believe the same version on my PocketBook Era, but whatever version is on my Era is rendering the ebooks the same way as on my phone. |
![]() |
![]() |
![]() |
#7 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
|
Quote:
This is from the end-of-chapter endnotes section: Code:
<div class="_idFootnotes"> . . . <div id="footnote-154" epub:type="footnote"> <p class="Footnote"><a href="#footnote-154-backlink">1</a>. L. Chiarini, <em>Arte e tecnica del film</em>, Ban, Laterza, 1962, p. 7.</p> . . . </div> |
|
![]() |
![]() |
![]() |
#8 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
|
I tried ReadEra (regular version) on my Android device and with my epub it doesn't do the page-bottom footnotes thing. They say ReadEra is based on CoolReader, but that didn't do it either. So, for me, it's still just KOReader displaying this behaviour.
Last edited by paperwhite13; 02-10-2024 at 03:42 AM. |
![]() |
![]() |
![]() |
#9 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,631
Karma: 103503445
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
And KOReader, while interesting, is not pre-installed on anything, nor on Playstore. I installed it from Git on my Android devices.
So basically this idea is tested on hardly anything that people commonly use and doesn't work on Pocketbook Android App, which is free and has 5M+ downloads or regular Readera which has 10M+ downloads. Kindle has about 92% of English language market, with majority reading on the Kindle app (Android, iOS, Mac, Windows, Amazon Fire), mostly on phones or tablets. Most Amazon eink in use is now able for KFX. All run AWZ3/KF8 except the K1, K2, DX and DXG, which are really old. Likely few K1 or K2 are running due to exhusted battery/cell). Edit: Playstore has 100M+ for Kindle app downloads. Amazon Fire (one of the best selling tablets) has Kindle App pre-installed. OTOH, Google claims 1 Billion+ downloads for Google PlayBooks & Audio Books app, yet Google has the lowest sales of any International ebook retailer. Last edited by Quoth; 02-10-2024 at 06:36 AM. |
![]() |
![]() |
![]() |
#10 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#11 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,631
Karma: 103503445
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Jailbroken Kindles is a tiny percentage of Kindle users. Pretty much only is done for KOReader. Also up-to-date FW usually can't be jailbroken.
I do have a jailbreak on a Kindle DX, partly out of curiosity and party to set the time, but not any other Kindle and none of the many Kindle users I know have any interest in Jailbreak or KOReader. Also you can read a pirated book on any ereader or app. It's the DRM'ed commercially sold or library loans that take expertise to read on a different device to that intended, and that doesn't need a jailbreak either. Jailbreaking is irrelevant to reading ebooks and the only thing that absolutely needs it is a wish to to use KOReader on a Kindle. Last edited by Quoth; 02-10-2024 at 07:11 AM. |
![]() |
![]() |
![]() |
#12 | |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,631
Karma: 103503445
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Quote:
But it's sales that feeds and houses the authors. |
|
![]() |
![]() |
![]() |
#13 | ||
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
|
Quote:
![]() Quote:
And the in page footnotes feature is great too, for me it doesn't matter it's not available in other apps. Perhaps it'll make even more people try it. |
||
![]() |
![]() |
![]() |
#14 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131
Karma: 9236
Join Date: Jun 2020
Device: Kindle PW3 [KOReader]
|
So, I'm certain you don't need <aside> for this to work (just enable the In Page Footnotes style tweak and you're good to go). As to why doesn't work with the other epubs I've tried, I've yet to determine, I'm certain most of those are EPUB3 as well. Maybe it's something really small, but necessary for this to work.
|
![]() |
![]() |
![]() |
#15 | ||
More Wiserer
![]() Posts: 9
Karma: 10
Join Date: Jan 2024
Device: Pocketbook Era (KOReader)
|
Quote:
Also to clarify on ReadEra, I hadn't tested on the regular version since I upgraded to Premium and didn't have it installed. However, installing it, the two apps perform the same as Premium and displays footnotes at the bottom of the page (tested with "A City on Mars" by Kelly and Zach Weinersmith out-of-the-box, and other ebooks I've modified with <aside> tags). In my experience, it's more complicated to test books in ReadEra (since it creates a library index, and takes more taps to navigate to the new test file you just created), so I've been focusing on KOReader since it's more flexible for testing and it's what I use on my PocketBook Era. Quote:
![]() I think the inline link also needs to be formatted a certain way. In "Lords and Ladies", I've been able to get the <aside> tag around the footnote text, but it only appears at the bottom of the page if I also modify the inline link. I'm going to upload my latest version of the script (name suffix "2024.02.10", which I modified to be more inclusive and works better than the other two) so you can play with it if you'd like. Additionally, sometime this weekend I'll update the Dropbox folder to include both the unmodified Scrambled epubs I have along with the modified versions as changed by the latest iteration of the script and the script's log output. |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issue with footnote pop-up (epub3) | carmenchu | Viewer | 5 | 01-06-2021 04:59 AM |
EPUB3 footnote validation | roger64 | Workshop | 11 | 06-03-2015 07:56 AM |
Mobi formatter wanted | AlexBell | Kindle Formats | 4 | 04-19-2011 05:34 AM |
Antenna House Formatter | canes816 | Calibre | 1 | 04-01-2010 12:46 AM |
iLiad RFCToiLiad formatter application | scotty1024 | iRex Developer's Corner | 0 | 10-16-2006 12:56 PM |