View Single Post
Old 12-31-2021, 03:20 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,036
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Table of Contents: Easy way to strip anchors?

Some books of mine, the ToC entries point to anchors at the beginning of the chapter, such as this:

Code:
<?xml version='1.0' encoding='utf-8'?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata" xml:lang="en">
  <head>
    <meta name="dtb:uid" content="af680924-8cd7-4751-bdc1-c3ba61017ec9"/>
    <meta name="dtb:depth" content="2"/>
    <meta name="dtb:generator" content="calibre (5.34.0)"/>
    <meta name="dtb:totalPageCount" content="0"/>
    <meta name="dtb:maxPageNumber" content="0"/>
  </head>
  <docTitle>
    <text>Table of Contents</text>
  </docTitle>
  <navMap>
    <navPoint id="num_1" playOrder="1">
      <navLabel>
        <text>Title Page</text>
      </navLabel>
      <content src="text/part0000.html#t1"/>
    </navPoint>
    <navPoint id="num_2" playOrder="2">
      <navLabel>
        <text>Copyright Page</text>
      </navLabel>
      <content src="text/part0001.html#x8267372"/>
    </navPoint>
    <navPoint id="num_3" playOrder="3">
      <navLabel>
        <text>Contents</text>
      </navLabel>
      <content src="text/part0002.html#x8267372"/>
    </navPoint>
    <navPoint id="num_4" playOrder="4">
      <navLabel>
        <text>Chapter One</text>
      </navLabel>
      <content src="text/part0003.html#x8267372"/>
    </navPoint>
    <navPoint id="num_5" playOrder="5">
      <navLabel>
        <text>Chapter Two</text>
      </navLabel>
      <content src="text/part0004.html#x8267372"/>
    </navPoint>
    <navPoint id="num_6" playOrder="6">
      <navLabel>
        <text>Chapter Three</text>
      </navLabel>
      <content src="text/part0005.html#x8267372"/>
    </navPoint>
    <navPoint id="num_7" playOrder="7">
      <navLabel>
        <text>Chapter Four</text>
      </navLabel>
      <content src="text/part0006.html#x8267372"/>
    </navPoint>
    <navPoint id="num_8" playOrder="8">
      <navLabel>
        <text>Chapter Five</text>
      </navLabel>
      <content src="text/part0007.html#x8267372"/>
    </navPoint>
    <navPoint id="num_9" playOrder="9">
      <navLabel>
        <text>Chapter Six</text>
      </navLabel>
      <content src="text/part0008.html#x8267372"/>
    </navPoint>
    <navPoint id="num_10" playOrder="10">
      <navLabel>
        <text>Chapter Seven</text>
      </navLabel>
      <content src="text/part0009.html#x8267372"/>
    </navPoint>
    <navPoint id="num_11" playOrder="11">
      <navLabel>
        <text>Chapter Eight</text>
      </navLabel>
      <content src="text/part0010.html#x8267372"/>
    </navPoint>
    <navPoint id="num_12" playOrder="12">
      <navLabel>
        <text>Chapter Nine</text>
      </navLabel>
      <content src="text/part0011.html#x8267372"/>
    </navPoint>
    <navPoint id="num_13" playOrder="13">
      <navLabel>
        <text>Chapter Ten</text>
      </navLabel>
      <content src="text/part0012.html#x8267372"/>
    </navPoint>
    <navPoint id="num_14" playOrder="14">
      <navLabel>
        <text>Chapter Eleven</text>
      </navLabel>
      <content src="text/part0013.html#x8267372"/>
    </navPoint>
    <navPoint id="num_15" playOrder="15">
      <navLabel>
        <text>Chapter Twelve</text>
      </navLabel>
      <content src="text/part0014.html#x8267372"/>
    </navPoint>
    <navPoint id="num_16" playOrder="16">
      <navLabel>
        <text>Chapter Thirteen</text>
      </navLabel>
      <content src="text/part0015.html#x8267372"/>
    </navPoint>
    <navPoint id="num_17" playOrder="17">
      <navLabel>
        <text>Chapter Fourteen</text>
      </navLabel>
      <content src="text/part0016.html#x8267372"/>
    </navPoint>
    <navPoint id="num_18" playOrder="18">
      <navLabel>
        <text>Chapter Fifteen</text>
      </navLabel>
      <content src="text/part0017.html#x8267372"/>
    </navPoint>
  </navMap>
</ncx>
I've noticed it mostly on books I purchased on Amazon, downloaded with Kindle 1.17 before importing into Calibre, and then converted to ePub. Though I did notice it on a few Kobo books too.

This causes a small glitch on Kobo where the chapter length chart shows gaps between each chapter. The easiest way to fix it is to strip the anchors from the NCX prior to sending, but this is a little time-consuming on longer books (or ones with hilariously disproportionate number of chapters for the length).

Is there an easier way to remove the anchors? I don't mind whether it's in editor or re-converting the ePubs.

Last edited by ownedbycats; 12-31-2021 at 03:28 PM.
ownedbycats is online now   Reply With Quote