I am having an interesting result in attempting to convert a MOBI file to EPUB format for reading on an iPod.
The Table Of Contents from the MOBI file, when viewed in Calibre's E-book viewer, is fine both from the in-text TOC links and the sidebar TOC for both first- and second-level destinations. That is, using either of them navigates precisely to the correct place in the book whether to a first-level or second-level section of the book.
In a converted EPUB file each TOC top-level link navigates to the last page *before* the TOC section desired. Second-level links navigate to the correct page. (Other hyperlinks from text to chapter end notes and back also function normally.) So the problem appears to be related to the structure or coding at the first level chapters or sections only.
I've tried tweaks to the conversion process from the 'Default Input Profile' to use 'Kindle' and 'Mobipocket' settings = no change. I'm not sure where to proceed from here without going down alleys of trial-and-error or dropping to use Sigil to hand edit the converted file. I've seen this result before, so I'm hopeful to learn of some Calibre tweak that makes these conversions easy and automated.
Using the Search/Regex Builder tool from the Calibre Conversion utility I have been able to extract the following code sample. This describes, from the original MOBI format file, the structure shown further below. (Line breaks have been added for readability.)
Code:
<pagebreak id="filepos56214">
<div class="mbp_pagebreak"/><p class="calibre_1119"><font size="6"><span class="italic"><span class="bold"><font color="#000">PART ONE</font></span></span></font></p><br/><p class="calibre_1119"><font size="6"><span class="italic"><span class="bold"><font color="#000">SECOND LINE OF FIRST-LEVEL TOC TEXT</font></span></span></font></p><br/>
<pagebreak id="filepos56501">
<div class="mbp_pagebreak"/>
<p class="calibre_1665"><font size="5"><span class="italic"><span class="bold"><font color="#000">CHAPTER 1</font></span></span></font></p><br/><p class="calibre_1665"><font size="5"><span class="italic"><span class="bold"><font color="#000">SECOND LINE OF FIRST-LEVEL TOC TEXT</font></span></span></font></p><br/>
<p class="calibre_1665"><font size="5"><span class="italic"><span class="bold"><font color="#000">THIS IS THE FIRST PARAGRAPH IN THE CHAPTER TEXT</font></span></span></font></p><br/><p class="calibre_1703"><font size="4"><span class="italic"><span class="bold"><font color="#000">THIS IS THE SECOND PARAGRAPH IN THE CHAPTER TEXT</font></span></span></font></p><br/><p class="calibre_1125"><font color="#000">THIS IS THE THIRD PARAGRAPH IN THE CHAPTER TEXT</font></p><br id="filepos59142"/>
<p class="calibre_30"><font size="5"><span class="bold"><font color="#000">THIS IS THE SECOND-LEVEL TOC TEXT</font></span></font></p><br/>
<p class="calibre_1125"><font color="#000">TEXT IN THE BOOK CONTINUES...
(An observation about the code given above and the structure given below:The content-TOC and the metadata-TOC both read as "Part One: This is The First Part" or "Chapter One: This is The First Chapter" -- with semi-colons. The code sample above does *not* include these semi-colons; I have included them in the structure sample below for readability only.)
This results in a navigation as below for the MOBI file, but the converted EPUB file ends up with first-level TOC navigation to the page prior to the intended destination.
Code:
some sort of page break
PART ONE: SECOND LINE OF FIRST-LEVEL TOC TEXT
some sort of page break
CHAPTER 1: SECOND LINE OF FIRST-LEVEL TOC TEXT
THIS IS THE FIRST PARA IN THE CHAPTER TEXT
THIS IS THE SECOND PARA IN THE CHAPTER TEXT
THIS IS THE THIRD PARA IN THE CHAPTER TEXT
THIS IS THE SECOND-LEVEL TOC TEXT
TEXT IN THE BOOK CONTINUES...
So .... is there some conversion tweak that can be used to correct the errors that cause first-level navigation to go awry while leaving the working second-level items intact?
Thx!