View Single Post
Old 03-28-2018, 09:54 AM   #29
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,622
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
You're not getting it.

NCX entry:
Code:
<navPoint id="navpoint-2" playOrder="2">
      <navLabel>
        <text>Chapter  Four</text>
      </navLabel>
      <content src="Text/part_one.xhtml#chap004"/>
    </navPoint>
the xhtml (a portion of part_one.xhtml):

Code:
<h3 id="chap001">Chapter One</h3>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>

<h3 id="chap002">Chapter Two</h3>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>

<h3 id="chap003">Chapter Three</h3>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>

<h3 id="chap004">Chapter Four</h2>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
<p> blah, blah, blah</p>
This particular epub (like many) has no html toc page. Only an ncx. You're completely wrong that an html toc is the only place that an ncx can "get hrefs with ids". You're making the mistake of only basing your reasoning on epubs that meet your particular criteria. Epubs don't have to have an html toc, so you need to allow for the fact that users will be using your plugin on such epubs

Your plugin will remove the id from <h3 id="chap004"> (because your parsing of all of the epub's xhtml reveals no hrefs that utilize the "chap004" id/fragment ) which will break the functionality of a user selecting Chapter Four from their reader's ncx-based navigation utility. Instead of going to the Chapter Four portion of the part_one.xhtml file, it will default to the beginning of the file (Chapter One), because the target id has been deleted for the entry they want.
DiapDealer is online now   Reply With Quote