View Single Post
Old 03-09-2011, 05:38 PM   #15
siebert
Developer
siebert has a complete set of Star Wars action figures.siebert has a complete set of Star Wars action figures.siebert has a complete set of Star Wars action figures.
 
Posts: 155
Karma: 280
Join Date: Nov 2010
Device: Kindle 3 (Keyboard) 3G / iPad 9 WiFi / Google Pixel 6a (Android)
Quote:
Originally Posted by kovidgoyal View Post
Your patch will not work for the following reasons:
It worked at least for my test documents and the real book I wanted to convert in the first place.

Quote:
1) You need to use an OrderedDict not {}
That's correct. On my python implementation the simple dictionary seems to work the same way as the OrderedDict, but only by accident.

Quote:
2) if a file contains an <h2> as the first element and an <h1> after it, then the <h2> will be added to the <h1> from that file instead of the the <h1> from the previous file
Also correct, I didn't thought of that case during my tests.

I've now created such an epub with sigil and your implementation creates the correct TOC, while mine misplaces the <h2> as described.

Quote:
I have fixed both issues, but I haven't really tested my fix, so let me know if there are any problems.
Thanks, it works fine for me.

Ciao,
Steffen
siebert is offline   Reply With Quote