View Single Post
Old 01-18-2011, 01:21 AM   #1
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
the case of the disappearing TOC

I have some books which contain a hard coded content / toc page i.e. it can be seem as an xhtml page in epub, e.g.
Code:
<body class="calibre">
  <p class="calibre9"><span class="calibre5 bold">Contents</span></p>

  <p><a class="calibre10"></a><a class="calibre10" id="filepos916"></a></p>

  <p class="calibre11"><a class="calibre12" href="../Text/Stories_All-New_Tales_split_003.html#filepos5958"><span class="calibre13 calibre14 sgc-1">Introduction:</span></a> Just Four Words Neil Gaiman</p>

  <p><a class="calibre10"></a><a class="calibre10" id="filepos1070"></a></p>

  <p class="calibre15"><a class="calibre12" href="../Text/Stories_All-New_Tales_split_004.html#filepos13963"><span class="calibre13 calibre14 sgc-1">Blood:</span></a> Roddy Doyle</p>
this type of "toc" appears well behaved i.e. calibre viewer detects it, calibre preserves it in format conversions... but those "toc" entries do not have header tags in the story files, and thus navigation with kindle buttons is impaired.
the "toc" is also referencing explicit locations in explicit split files, and the number of split files is not always the same as the number of toc entries. ( in this example they match but I have other books where many toc entry points are squeezed into a few xhtml splits, referenced by filepos code e.g.
Code:
<navPoint class="chapter" id="c07b675a-c357-498a-a48c-cdc24750b605" playOrder="4">
      <navLabel>
        <text>THE PUNISHED</text>
      </navLabel>
      <content src="Beauty_s_Punishment_split_001.html#filepos2996"/>
chapter 4 in file 1

ANYWAY if these epubs iare opened & saved with sigil, then suddenly there is no toc in calibre viewer - all you get is a one line "start" entry.

some before and after viewing of exploded epub shows that sigil is rewriting the toc.ncx file, thus this
Code:
<docTitle>
    <text>Stories: All-New Tales</text>
  </docTitle>
  <navMap>
    <navPoint class="chapter" id="33c52f2d-e3f0-4394-94fe-2081b1133809" playOrder="1">
      <navLabel>
        <text>Introduction:</text>
      </navLabel>
      <content src="Stories_All-New_Tales_split_003.html"/>
    </navPoint>
    <navPoint class="chapter" id="081f987c-44c5-4cd5-af9c-fb1cca814843" playOrder="2">
      <navLabel>
        <text>Blood:</text>
      </navLabel>
      <content src="Stories_All-New_Tales_split_004.html"/>
    </navPoint>
    <navPoint class="chapter" id="26096607-bf5a-49f9-a5a6-a40be7ef6b85" playOrder="3">
      <navLabel>
        <text>Fossil-Figures:</text>
becomes this after a sigil save
Code:
<docTitle>
        <text>Stories: All-New Tales</text>
    </docTitle>
    <navMap>
        <navPoint id="navPoint-1" playOrder="1">
            <navLabel>
                <text>Start</text>
            </navLabel>
            <content src="Text/titlepage.xhtml"/>
        </navPoint>
    </navMap>
</ncx>
so - issues
1. I cannot edit books with this type of hard coded toc e.g. to fix typos without losing the toc navigation in viewers.
2. I see no foolproof way of directly converting this type of toc to one that will survive editing - best I have for now is the roundabout epub - zip - convert with structure detect & hope that builds a "proper" toc.

what is annoying is that the "table of contents" text, layout ,links etc still exist in the xhtml - they are just no longer considered to be "toc"

Last edited by cybmole; 01-18-2011 at 01:27 AM.
cybmole is offline   Reply With Quote