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.