Well I think I finally got there. I've attached updated HTML and the resulting EPUB.
- In the HTML file added some new <h1> and <h2> paragraphs. Look for all references to the word invisible in both the CSS and HTML sections. I also had to remove 5 forced page-breaks, 1 just before each of the 5 Parts begins.
- Use these Calibre conversion settings for ZIP to EPUB:
Code:
Structure Detection - Detect Chapters at - //h:h1[re:test(@class, "invisible", "i")]
Structure Detection - Chapter mark - none
Structure Detection - Insert pagebreaks before - //h:h2[re:test(@class, "invisible", "i")]
Table of Contents - Level 1 TOC - //h:h1[re:test(@class, "invisible", "i")]
Table of Contents - Level 2 TOC - //h:h2[re:test(@class, "invisible", "i")]
Table of Contents - Level 3 TOC - //h:h3
Look & Feel - Extra CSS - nothing required here anymore, required CSS now inside HTML file
- Tweak the EPUB. I'm not sure why this step is necessary. It may be a slight bug in the conversion process??? It would need to be reported in the Calibre ticket system to have an expert diagnose the problem. However, the above conversion produces an EPUB which looks like your PDF (I think) but as previously, when viewed in the Calibre viewer or the Firefox epubreader addon, if you select a Level 1 TOC item then it points to the wrong place (Level2s and Level3s are fine). I rectified this by using Calibre's EPUB-tweak feature to manually edit the toc.ncx file in a text editor. Only 5 small changes required to correct the destination of each of the Level 1 items (or Parts in your terms) so it points to the first Chapter in the Part, i.e. the same piece of HTML as the next item down in the toc.ncx file.
I'm guessing that setting Structure Detection - Chapter mark to none is not that common and pagebreak is what most people use. You could then make a 'feature' of the leader page which contains only the 'Part x ~ ...' name, maybe with special formatting or an extra image. If you did it this way no epub-tweaking would be required.
Anyway, see what you think of the new EPUB