View Single Post
Old 04-22-2022, 09:23 AM   #1
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 786
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Sage
Insert Inline Table of Contents: Modify ePub Deletes It

In another learning attempt, I took an old book, stripped out much of the CSS from the EPUB, and re-did it. When I was done, I had the Calibre Editor make a new toc.ncx. So, I went to:

Tools > Table of Contents > Edit Table of Contents

and had it create the toc.xhtml (I think that's what it's doing) first. I had it Generate ToC from XPath using the wizard based on h2. Then I went to:

Tools > Table of Contents > Insert Inline Table of Contents

and had it create the toc.ncx. It looked good to me and RunEpubCheck was happy with it. I saved it, closed it, and went back to Calibre, itself, to run Modify ePub (which I have set to Remove Broken TOC Entries in NCX File (among other things)). It deleted the contents of the ncx.toc (specifically, everything between the <navMap> tags. I'm assuming I've done something very wrong. But, it's possible either the Calibre Editor or Modify ePub are doing something wrong. Could someone take a look at the Modify ePub log and toc.ncx to see what wrong?

Code:
Modify ePubs version (1, 7, 0)
Logfile for book ID 4 (Piccadilly Jim / PG Wodehouse)
Job details 4
  Modifying:  /tmp/calibre_5.41.0_tmp_lep7zgxy/juxwd_cn_modify_epub/4.epub
	Updating metadata and cover
	  Parsing xml file: content.opf
	  Parsing xml file: toc.ncx
	Looking for redundant entries in manifest
	Looking for unmanifested files
	Looking for broken links in the NCX
	  TOC Navpoint broken to remove of: text/Chapter-01.html
	  TOC Navpoint broken to remove of: text/Chapter-02.html
	  TOC Navpoint broken to remove of: text/Chapter-03.html
	  TOC Navpoint broken to remove of: text/Chapter-04.html
	  TOC Navpoint broken to remove of: text/Chapter-05.html
	  TOC Navpoint broken to remove of: text/Chapter-06.html
	  TOC Navpoint broken to remove of: text/Chapter-07.html
	  TOC Navpoint broken to remove of: text/Chapter-08.html
	  TOC Navpoint broken to remove of: text/Chapter-09.html
	  TOC Navpoint broken to remove of: text/Chapter-10.html
	  TOC Navpoint broken to remove of: text/Chapter-11.html
	  TOC Navpoint broken to remove of: text/Chapter-12.html
	  TOC Navpoint broken to remove of: text/Chapter-13.html
	  TOC Navpoint broken to remove of: text/Chapter-14.html
	  TOC Navpoint broken to remove of: text/Chapter-15.html
	  TOC Navpoint broken to remove of: text/Chapter-16.html
	  TOC Navpoint broken to remove of: text/Chapter-17.html
	  TOC Navpoint broken to remove of: text/Chapter-18.html
	  TOC Navpoint broken to remove of: text/Chapter-19.html
	  TOC Navpoint broken to remove of: text/Chapter-20.html
	  TOC Navpoint broken to remove of: text/Chapter-21.html
	  TOC Navpoint broken to remove of: text/Chapter-22.html
	  TOC Navpoint broken to remove of: text/Chapter-23.html
	  TOC Navpoint broken to remove of: text/Chapter-24.html
	  TOC Navpoint broken to remove of: text/Chapter-25.html
	  TOC Navpoint broken to remove of: text/Chapter-26.html
	Looking for Adobe xpgt files and links to remove
	Looking for pagemaps
	Looking for Google Play pagemaps
	Looking for Adobe DRM meta tags to remove
	Looking for legacy jackets
	Adding or updating jacket
	 Current jacket removed:  jacket.xhtml
	  Manifest item removed: jacket.xhtml (calibre_jacket)
	  Spine itemref removed: calibre_jacket
	  Manifest item added: jacket.xhtml (calibre_jacket)
	  Spine item inserted: calibre_jacket at pos: 0
	Looking for html pages containing only broken image links
	Looking for non dc: elements in manifest
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	  Removing child: 
	Looking for html files to remove charset meta tags/encode to utf-8
	  Switched to UTF-8 encoding for: toc.xhtml
	  Switched to UTF-8 encoding for: text/titlepage.xhtml
	Looking for CSS margins
	Looking for inline javascript blocks to remove
	Looking for .js files to remove
	Applying smarten punctuation
	Stripping Kobo remnants
	  Stripped Kobo spans in: text/titlepage.xhtml
	Looking for files to remove: ['iTunesMetadata.plist', 'iTunesArtwork']
	Looking for files to remove: ['META-INF/calibre_bookmarks.txt']
	  Found file to remove: META-INF/calibre_bookmarks.txt
	Looking for files to remove: ['.DS_Store', 'thumbs.db']
	Looking for unused images
	Stripping spans
	Unprettying files
	  De-indented: toc.xhtml
	  De-indented: text/titlepage.xhtml
	  De-indented: text/part0000_split_000.html
	Insert or replace cover
	...Looking for guide cover reference
	  Found guide cover reference to:  text/titlepage.xhtml
	  Related manifest item id: titlepage
	...Looking for meta cover
	...Looking for other.ms-* guide references to clean out
	...Working with possible existing cover: text/titlepage.xhtml
	  Guide reference removed: text/titlepage.xhtml
	...Looking for TOC navpoint for this cover
	...Inspecting old cover for removal
	  Cover page contains only this image so can be deleted
	  Manifest item removed: text/titlepage.xhtml (titlepage)
	  Spine itemref removed: titlepage
	  Checking safe to remove cover image: cover.jpeg
	  No other html pages use this image, safe to remove
	  Manifest item removed: cover.jpeg (cover)
	...Writing new cover image and titlepage html
	  New cover image written to: cover.jpeg
	  New titlepage html written to: text/titlepage.xhtml
	...Updating manifest and TOC for the new cover
	  Manifest item added: text/titlepage.xhtml (titlepage)
	  Manifest item added: cover.jpeg (cover)
	  Meta item inserted: cover:cover
	  Spine item inserted: titlepage at pos: 0
	  Guide item inserted: text/titlepage.xhtml:Cover:cover
	...Remove any orphaned guide images
	...Apply device specific fixes
	...Cover modifications completed
ePub updated in 0.84 seconds

The Calibre Editor toc.ncx looked like:

Code:
<?xml version='1.0' encoding='utf-8'?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="en">
  <head>
    <meta name="dtb:uid" content="a114198a-8139-46e8-a383-4b27a0a72413"/>
    <meta name="dtb:depth" content="2"/>
    <meta name="dtb:generator" content="calibre (5.41.0)"/>
    <meta name="dtb:totalPageCount" content="0"/>
    <meta name="dtb:maxPageNumber" content="0"/>
  </head>
  <docTitle>
    <text>Piccadilly Jim</text>
  </docTitle>
  <navMap>
    <navPoint id="num_1" playOrder="1">
      <navLabel>
        <text>CHAPTER I: A RED-HAIRED GIRL</text>
      </navLabel>
      <content src="text/Chapter-01.html"/>
    </navPoint>
    <navPoint id="num_2" playOrder="2">
      <navLabel>
        <text>CHAPTER II: THE EXILED FAN</text>
      </navLabel>
      <content src="text/Chapter-02.html"/>
    </navPoint>
    <navPoint id="num_3" playOrder="3">
      <navLabel>
        <text>CHAPTER III: FAMILY JARS</text>
      </navLabel>
      <content src="text/Chapter-03.html"/>
    </navPoint>
    <navPoint id="num_4" playOrder="4">
      <navLabel>
        <text>CHAPTER IV: JIMMY’S DISTURBING NEWS</text>
      </navLabel>
      <content src="text/Chapter-04.html"/>
    </navPoint>
    <navPoint id="num_5" playOrder="5">
      <navLabel>
        <text>CHAPTER V: THE MORNING AFTER</text>
      </navLabel>
      <content src="text/Chapter-05.html"/>
    </navPoint>
    <navPoint id="num_6" playOrder="6">
      <navLabel>
        <text>CHAPTER VI: JIMMY ABANDONS PICCADILLY</text>
      </navLabel>
      <content src="text/Chapter-06.html"/>
    </navPoint>
    <navPoint id="num_7" playOrder="7">
      <navLabel>
        <text>CHAPTER VII: ON THE BOAT-DECK</text>
      </navLabel>
      <content src="text/Chapter-07.html"/>
    </navPoint>
    <navPoint id="num_8" playOrder="8">
      <navLabel>
        <text>CHAPTER VIII: PAINFUL SCENE IN A CAFE</text>
      </navLabel>
      <content src="text/Chapter-08.html"/>
    </navPoint>
    <navPoint id="num_9" playOrder="9">
      <navLabel>
        <text>CHAPTER IX: MRS. PETT IS SHOCKED</text>
      </navLabel>
      <content src="text/Chapter-09.html"/>
    </navPoint>
    <navPoint id="num_10" playOrder="10">
      <navLabel>
        <text>CHAPTER X: INSTRUCTION IN DEPORTMENT</text>
      </navLabel>
      <content src="text/Chapter-10.html"/>
    </navPoint>
    <navPoint id="num_11" playOrder="11">
      <navLabel>
        <text>CHAPTER XI: JIMMY DECIDES TO BE HIMSELF</text>
      </navLabel>
      <content src="text/Chapter-11.html"/>
    </navPoint>
    <navPoint id="num_12" playOrder="12">
      <navLabel>
        <text>CHAPTER XII: JIMMY CATCHES THE BOSS’S EYE</text>
      </navLabel>
      <content src="text/Chapter-12.html"/>
    </navPoint>
    <navPoint id="num_13" playOrder="13">
      <navLabel>
        <text>CHAPTER XIII: SLIGHT COMPLICATIONS</text>
      </navLabel>
      <content src="text/Chapter-13.html"/>
    </navPoint>
    <navPoint id="num_14" playOrder="14">
      <navLabel>
        <text>CHAPTER XIV: LORD WISBEACH</text>
      </navLabel>
      <content src="text/Chapter-14.html"/>
    </navPoint>
    <navPoint id="num_15" playOrder="15">
      <navLabel>
        <text>CHAPTER XV: A LITTLE BUSINESS CHAT</text>
      </navLabel>
      <content src="text/Chapter-15.html"/>
    </navPoint>
    <navPoint id="num_16" playOrder="16">
      <navLabel>
        <text>CHAPTER XVI: MRS. PETT TAKES PRECAUTIONS</text>
      </navLabel>
      <content src="text/Chapter-16.html"/>
    </navPoint>
    <navPoint id="num_17" playOrder="17">
      <navLabel>
        <text>CHAPTER XVII: MISS TRIMBLE, DETECTIVE</text>
      </navLabel>
      <content src="text/Chapter-17.html"/>
    </navPoint>
    <navPoint id="num_18" playOrder="18">
      <navLabel>
        <text>CHAPTER XVIII: THE VOICE PROM THE PAST</text>
      </navLabel>
      <content src="text/Chapter-18.html"/>
    </navPoint>
    <navPoint id="num_19" playOrder="19">
      <navLabel>
        <text>CHAPTER XIX: BETWEEN FATHER AND SON</text>
      </navLabel>
      <content src="text/Chapter-19.html"/>
    </navPoint>
    <navPoint id="num_20" playOrder="20">
      <navLabel>
        <text>CHAPTER XX: CELESTINE IMPARTS INFORMATION</text>
      </navLabel>
      <content src="text/Chapter-20.html"/>
    </navPoint>
    <navPoint id="num_21" playOrder="21">
      <navLabel>
        <text>CHAPTER XXI: CHICAGO ED</text>
      </navLabel>
      <content src="text/Chapter-21.html"/>
    </navPoint>
    <navPoint id="num_22" playOrder="22">
      <navLabel>
        <text>CHAPTER XXII: IN THE LIBRARY</text>
      </navLabel>
      <content src="text/Chapter-22.html"/>
    </navPoint>
    <navPoint id="num_23" playOrder="23">
      <navLabel>
        <text>CHAPTER XXIII: STIRRING TIMES FOR THE PETTS</text>
      </navLabel>
      <content src="text/Chapter-23.html"/>
    </navPoint>
    <navPoint id="num_24" playOrder="24">
      <navLabel>
        <text>CHAPTER XXIV: SENSATIONAL TURNING OF A WORM</text>
      </navLabel>
      <content src="text/Chapter-24.html"/>
    </navPoint>
    <navPoint id="num_25" playOrder="25">
      <navLabel>
        <text>CHAPTER XXV: NEARLY EVERYBODY HAPPY</text>
      </navLabel>
      <content src="text/Chapter-25.html"/>
    </navPoint>
    <navPoint id="num_26" playOrder="26">
      <navLabel>
        <text>CHAPTER XXVI: EVERYBODY HAPPY</text>
      </navLabel>
      <content src="text/Chapter-26.html"/>
    </navPoint>
  </navMap>
</ncx>
and the h2 tags that the ToC Editor used to create the ToC look like this:

Code:
<h2>CHAPTER I: A RED-HAIRED GIRL</h2>
and are the first thing after the <body> tag in the individual chapter files I had the Calibre Editor create by first merging all the text files and then splitting them at those <h2> tags with its wizard.

EDIT: And, here's the toc.xhtml it generated to base the toc.ncx of off:

Code:
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Table of Contents</title>
<style type="text/css">
 li {
 list-style-type: none;
 padding-left: 2em;
 margin-left: 0;
 }
 a {
 text-decoration: none;
 }
 a:hover {
 color: red;
 }
</style>
</head>

<body id="calibre_generated_inline_toc">
<h2>Table of Contents</h2>

<ul class="level1">
<li><a href="text/Chapter-01.html">CHAPTER I: A RED-HAIRED GIRL</a></li>
<li><a href="text/Chapter-02.html">CHAPTER II: THE EXILED FAN</a></li>
<li><a href="text/Chapter-03.html">CHAPTER III: FAMILY JARS</a></li>
<li><a href="text/Chapter-04.html">CHAPTER IV: JIMMY’S DISTURBING NEWS</a></li>
<li><a href="text/Chapter-05.html">CHAPTER V: THE MORNING AFTER</a></li>
<li><a href="text/Chapter-06.html">CHAPTER VI: JIMMY ABANDONS PICCADILLY</a></li>
<li><a href="text/Chapter-07.html">CHAPTER VII: ON THE BOAT-DECK</a></li>
<li><a href="text/Chapter-08.html">CHAPTER VIII: PAINFUL SCENE IN A CAFE</a></li>
<li><a href="text/Chapter-09.html">CHAPTER IX: MRS. PETT IS SHOCKED</a></li>
<li><a href="text/Chapter-10.html">CHAPTER X: INSTRUCTION IN DEPORTMENT</a></li>
<li><a href="text/Chapter-11.html">CHAPTER XI: JIMMY DECIDES TO BE HIMSELF</a></li>
<li><a href="text/Chapter-12.html">CHAPTER XII: JIMMY CATCHES THE BOSS’S EYE</a></li>
<li><a href="text/Chapter-13.html">CHAPTER XIII: SLIGHT COMPLICATIONS</a></li>
<li><a href="text/Chapter-14.html">CHAPTER XIV: LORD WISBEACH</a></li>
<li><a href="text/Chapter-15.html">CHAPTER XV: A LITTLE BUSINESS CHAT</a></li>
<li><a href="text/Chapter-16.html">CHAPTER XVI: MRS. PETT TAKES PRECAUTIONS</a></li>
<li><a href="text/Chapter-17.html">CHAPTER XVII: MISS TRIMBLE, DETECTIVE</a></li>
<li><a href="text/Chapter-18.html">CHAPTER XVIII: THE VOICE PROM THE PAST</a></li>
<li><a href="text/Chapter-19.html">CHAPTER XIX: BETWEEN FATHER AND SON</a></li>
<li><a href="text/Chapter-20.html">CHAPTER XX: CELESTINE IMPARTS INFORMATION</a></li>
<li><a href="text/Chapter-21.html">CHAPTER XXI: CHICAGO ED</a></li>
<li><a href="text/Chapter-22.html">CHAPTER XXII: IN THE LIBRARY</a></li>
<li><a href="text/Chapter-23.html">CHAPTER XXIII: STIRRING TIMES FOR THE PETTS</a></li>
<li><a href="text/Chapter-24.html">CHAPTER XXIV: SENSATIONAL TURNING OF A WORM</a></li>
<li><a href="text/Chapter-25.html">CHAPTER XXV: NEARLY EVERYBODY HAPPY</a></li>
<li><a href="text/Chapter-26.html">CHAPTER XXVI: EVERYBODY HAPPY</a></li>
</ul>
</body>
</html>

Last edited by enuddleyarbl; 04-22-2022 at 09:35 AM.
enuddleyarbl is offline