![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
To correct endnotes links: a proposal
Hi
To batch correct broken links Kovid Goyal some months ago enabled the Editor to detect and repair broken links. However, the Editor does not repair yet the broken links due to a wrong chapter number that we may find for example in the file containing the return links. This script below allows you to do it. It has been written by pingouinux (Ubuntu). Doitsu helped to debug it (now repaired). For your information, this script has been successfully tested for one EPUB with 106 xhtml files and 837 -broken- endnotes (two seconds). Please find enclosed the test epub, the script and these comments. Before using it, open it to check your version of python. It works with 3 and 3.5. I did not try 2.7 You can customize the variables "chapter" and "xhtml". check that the script is executable. Testing the script For this purpose, I join a demo lorem.epub (EPUB2) with seven broken links due to wrong chapter numbers. 1. - Check it. The errors are reported by the Calibre Editor which does not repair them. 2. - Unzip the EPUB. Put it aside. 3. - Open the FILES, then the OEBPS folder. 4. - Put yourself in the path and launch with a terminal (Linux) Code:
$./pingouin3.py 5. - Delete chapter3.xhtml 6. - Rename chapter3modif.xhtml to chapter3.xhtml 7. - Open the EPUB, select chapter3.xhtml and change it (right-click) for the new chapter3.xhtml file in the OEBPS folder. Save. 8. - Check you EPUB: the errors are gone. Comment This is a very slow but fool-proof method to use it because the renaming of files with the Calibre editor can be tricky for beginners (it can generate "../chapter" instead of "chapter" for example). Later, this process will of course be simplified, mainly at the steps 5 and 6. Of course, the ideal would be to make this repair script work directly within the Calibre editor either as a function or otherwise. But for this, some expert help is needed. ![]() |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi
The joint zip includes a new version of the script named pingouin4.py The former one did not process text file numbers beginning with 0, like chapter01.xhtml, chapter02.xhtml, etc. This has been corrected with this version. EDIT: a small correction was needed. pingouin5.py is now in charge. 2nd of March 2016. Sorry for this ![]() Last edited by roger64; 03-02-2016 at 05:31 AM. Reason: new version |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Touch Normal links becomes footnotes links in epub made with Calibre | il_mix | Kobo Reader | 15 | 08-10-2014 01:19 PM |
Touch Gotta Improve Links to Endnotes | SCION | Kobo Reader | 9 | 07-17-2011 08:48 AM |
File splitting and endnotes links | mtrahan | ePub | 11 | 05-01-2011 04:07 PM |
Links to URLs work, internal links don't? | NewDay | ePub | 36 | 10-27-2010 04:09 AM |