![]() |
#1 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Aug 2022
Device: samsung s8
|
bridging endnotes in scanned document
have a scanned book, the author put the endnotes at the end of the chapter. but when converting to docx, endnotes bookmarks and hyperlinks are not created. There are close to 600 endnotes I don't want to do it manually Is there a macro or shortcut to link the endnotes?
Thanks in advance. |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Welcome to MR!
Assuming there are no issues with copyright then the question is whether the notes have a standardized format that is distinct from surrounding text. If they are then you can use regex to create them. Sigil or Calibre Editor have that functionality. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
![]() ![]() Quote:
But to speed things up, there are a few tricks you can do with:
If the code in your EPUB is clean, it's relatively simple. - - - Let's say your book has footnotes in the form of: Chapter1.xhtml: Code:
<p>This is an example.<sup>1</sup></p> Code:
<p>1. This is an endnote.</p>
and all endnotes have:
Your book will probably have slightly different code/patterns... But these will help when you create a regular expression! What you ultimately want is something like this: Code:
<p>This is an example.<a href="#fn1" id="ft1">[1]</a></p> <hr /> <p class="footnote"><a href="#ft1" id="fn1">[1]</a> An example footnote.</p>
These are just 2 simple HTML links pointing back/forth! So... How do we get there? Step 1: Regular Expressions - - - Note: In Sigil/Calibre, make sure you put your search into "Regex" Mode. After you are done, make sure you set it back to how it was. - - - Step 1.1: Change Superscript into Clickable Link We want to change <sup>1</sup> into an actual link: Search: <sup>(\d+)</sup> Replace: <a href="#fn\1" id="ft\1">[\1]</a> How does this search work?
Replace says:
- - - Now, we just do the opposite. Step 1.2: Change Footnote/Endnote into Clickable Link Search: <p>(\d+)\. Replace: <p class="footnote"><a href="#ft\1" id="fn\1">[\1]</a> Again, this is very similar. The Search is doing:
Replace is very similar. - - - Step 1.3: Test Links Back/Forth Open up the book in Preview, then click the links and see if they work! If they send you to the proper location, great! You're all done. ![]() - - - Step 2 (Optional): Merge + Split Files Honestly, I recommend footnotes at the end of each file... this:
If you want to have a separate endnotes file... you can follow the trick I wrote about in: This combines all files into one "merged.xhtml" file, then splits them all back up. This lets Sigil/Calibre take care of all the renaming of chapter links. - - - - - - - Side Note: If you want to learn even more about footnotes, I've written about this extensively over the years. Type this in your favorite search engine: Code:
footnotes tex2002ans site:mobileread.com And remember: Get the notes into clean links. And KISS (Keep It Simple, Stupid)! The less complicated your make your code, the less likely things are going to go wrong. ![]() Last edited by Tex2002ans; 08-29-2022 at 04:41 PM. |
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Aug 2022
Device: samsung s8
|
Thank you so much friends.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Endnotes within Endnotes | Alcuin7 | Editor | 22 | 11-30-2018 01:41 PM |
Glo tapping on endnotes | meneillosmr | Kobo Reader | 14 | 01-26-2016 10:14 AM |
About pop-up endnotes | roger64 | Conversion | 4 | 01-07-2016 07:15 PM |
Endnotes | Siam | Sigil | 14 | 03-17-2013 02:05 PM |
How to convert a Word document into a Kindle document? | PS Kindle | Kindle Developer's Corner | 2 | 12-08-2009 08:40 PM |