Quote:
Originally Posted by chaot
Inhalt Start of Contents of one book of six. Alltogether more then thousand headings. That needs a sophisticated system.
|
Thousands of headings? What is this book, a collection of poems?
If your book has all the headings marked as <h3>, then you could use Sigil to help you.
Take your original code:
If you run Sigil's Tools -> Table of Contents -> Generate Table of Contents. Now your HTML will get the
BOLD parts added:
Then you use Sigil to just generate the HTML Table of Contents:
Now you can use Sigil's unique IDs as a basis to Regex (instead of your convoluted crazy "u3458976345" system).
Now, for some reason, you want to jump from your HTML headings BACK to the TOC... so you might want to do this:
Search: <a href="([^\#"]+#)([^"]+)">
Replace: <a id="\2" href="\1\2">
Then you go back to the text and do this:
Search: <h3 id="([^"]+)">(.+?)</h3>
Replace: <h3 id="\1"><a href="../Text/TOC.xhtml#\1">\2</a></h3>
This will allow your <h3>s to point right back to their spot in the TOC:
Quote:
Originally Posted by stumped
What do the IDs actually do anyway. I have stripped all of them from some epub books with no apparent impact on readability. Everthing still seems to work ?
|
As others have stated, in your typical Fiction, it probably wouldn't have too many uses (although each book is unique, I wouldn't go ripping IDs out without seeing if they serve some purpose).
But take Non-Fiction for example, you might have something like this:
Quote:
<p class="equation" id="Equation1.1">E = mc<sup>2</sup></p>
[...]
<p>As Einstein said in <a href="../Text/Chap1.xhtml#Equation1.1">Equation 1.1</a>, energy is mass, and mass is energy.</p>
|
or let us say you had an annotated version. You might use the ID to point to a specific paragraph:
Quote:
<p id="ActIII.Scene1.p20"><b>Hamlet.</b> To be, or not to be―that is the question:</p>
[...]
<p>One of the most famous lines in all of literature <a href="../Text/ActIII.xhtml#ActIII.Scene1.p20">was spoken by Hamlet</a>.</p>
|
So let us say you ripped out all of the IDs out of Hamlet... on the surface everything looks A-OK... but if you pushed the link, it wouldn't lead you to the correct location (or the link might not work at all).