View Single Post
Old 01-15-2016, 05:23 AM   #7
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,625
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Hi

A friend of mine wrote a Python script (python 3.5 but you can change it to 3).

It works on the text files (xhtml) of an unzipped EPUB.
The books links have this shape

links in the text files
Code:
href="chapterX#ftn1" id=bodyftn1
return links (placed in the last numbered chapter X)
Code:
href="chapter14#bodyftn1" id=ftn1
If your last chapter X points to wrong chapters numbers, it scans the text files and correct these figures. Its output is a new chapterXmodif.xhtml file and it does not destroy anything.

However, when I tried to put back this new file within the EPUB I had some trouble (some entities appearing). I would probably need some advice on doing it.

If somebody wishes to test it, here it is. Thanks for any help or advice. The ultimate goal is to make a Calibre function out of this.
Attached Files
File Type: zip pingouin2.zip (1,020 Bytes, 138 views)

Last edited by roger64; 01-15-2016 at 05:35 AM. Reason: typo
roger64 is offline   Reply With Quote