View Single Post
Old 07-18-2010, 05:40 AM   #7
JulianL
Junior Member
JulianL began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2010
Location: London, UK
Device: iPhone & iPad
Quote:
Originally Posted by kovidgoyal View Post
Use Sigil to edit the TOC in the epub
I got some wierdness when I tried to use Sigil to edit the TOC on my Calibre-converted books.

As stated previously in this thread, the Calibre PML -> ePub conversion did generate a TOC that has all the expected entries in it when accessed from the built in Calibre book viewer and when downloaded to my iPhone and accessed via iBooks, the issue is that the TOC is all at a single level rather than nested. I was hoping that when I loaded the ePub into Sigil that I would see the flat TOC and could then set the necessary hierarchy levels but for some reason when I load an ePub that has one of these "seemingly OK but all one level" TOCs into Sigil then Sigil doesn't see any sort of TOC at all.

I really don't want to go through the actual text of the books to recreate TOC entries (mainly because I don't want to risk accidentally viewing some random but important pieces of text deep into the books as I process them and possibly spoiling a book for me when I subsequently some to read it).

My new plan is to post process my PML books using the xPml2XHtml python script that I originally got via links on the DarkReverser site. My searching here has already revealed that there is someone called KevinH on this forum who seems to be a developer of this script so hopefully he might still be around. I've already done a few experiments running the python script and then importing that xhtml book into Calibre and it seems to actually be slightly better in terms of the formatting of the text itself (there were a few little formatting issues that were tripping up the PML -> ePub Calibre conversion in a couple of isolated places).

As far as the TOC goes though the situation is one step forward and two steps back. I do seem to get the correct <h1>/<h2> nestings but for 2 out of the 3 books that I've tried I get a correctly nested TOC, with the correct number of entries, but every entry in the TOC is named "Untitled".

It's progress of a sort, and with this new approach I think I have a couple of things going for me that might mean I end up with a good result (i) The ability to very easily view the xhtml output by the python conversion and if I see anything that I think is tripping up the subsequent Calibre conversion then I might be able to remember enough of my Comp Sci degree to look at making changes to the Python script myself to patch things up, and (ii) If KevinH and possibly others are still around then this code path that I'm using might be more actively supported than the PML input converter.

I'll go and do some more experiments and post back if necessary, possibly under a new thread since I think we've determined what was going on with the X0 and X1 conversions before.

- Julian
JulianL is offline   Reply With Quote