![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Inline TOC makes a lot of ID= tags
Code:
<ul class="level2"> <li><a href="text/the_text.xhtml#u3dafb0a3-e4f3-4ce0-a10e-c333cb0e7178">Chapter 01 heading</a> <ul class="level3"> <li><a href="text/the_text.xhtml#u718b5b2d-8977-4a91-bad9-40e70179b583">Topic 01.01 heading</a></li> <li><a href="text/the_text.xhtml#u55fec99b-4e1f-4364-9825-2573328a698c">Topic 01.02 heading</a></li> <li><a href="text/the_text.xhtml#u1056602a-62da-4b26-bcaa-7b939c5fbdaa">Topic 01.03 heading</a></li> </ul> It doesn't seem to hurt anything and I RegEx them out, but Q1 - Do they serve any purpose that I'm not aware of? Q2 - Kovid -- would it be possible to avoid generating them ... please? I personally prefer a very clean epub since I'm old and get confused easily ![]() Thanks Last edited by phossler; 05-01-2014 at 08:26 PM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,568
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
They're url fragments. There's a corresponding id for them in the xhtml file(s). That's where the link takes you.
If each link takes you to a separate html file ... then you probably don't need them. But your code snippet shows three links to the very same html file; so the id/fragment is necessary to get to the proper place in the html file. If you remove them, all three links will take you to the very top of the same html file, instead of the various sections indicated by the toc. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
I must have deleted the ID's in the html files that the regular TOC put in, and the inline TOC used the information from the toc.ncx Since my little experiment epub was so small, I never noticed the link destination was always to the top of the file That will teach me to not do anythong clever Thanks again |
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,568
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No problem.
Nice to see some people actually read a signature occasionally. ![]() To be perfectly honest, though; I'm so used to seeing it typed that way I nearly missed it! Last edited by DiapDealer; 05-01-2014 at 10:21 PM. |
![]() |
![]() |
![]() |
#5 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I believe I raised the issue of ids generated with the ToC a while back and convinced Kovid to optimize it; now id attributes should not be created if a generated link will go to the first section in a file. So if calibre creates an id you can be sure it is important.
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
![]() Code:
u718b5b2d-8977-4a91-bad9-40e70179b583 |
|
![]() |
![]() |
![]() |
#7 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
If only it could tell when steak should really be stake, join split paragraphs, put in or remove bad bolding/italics, and a great deal of other stuff it requires intelligence to analyze. Too bad it can't also write the book for you.
What exactly is a meaningful id and how do you tell calibre how to create them? |
![]() |
![]() |
![]() |
#8 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
That is something that Kovid is pondering now, since I asked him to try so that when you tried to create a link, you could have some idea what it referred too.
|
![]() |
![]() |
![]() |
#9 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Also, I remember the discussion about this where the no-id-for-top-element thing got discussed (can't find it anymore though) and I believe Kovid said he wants to use UUIDs to avoid accidentally clashing with pre-existing ids. UUID is pretty much guaranteed to be unique. Maybe now he has some nice code in the Insert Link feature, calibre can avoid pre-existing ids and/or use them smartly. ![]() ![]() Last edited by eschwartz; 05-02-2014 at 03:51 PM. |
|
![]() |
![]() |
![]() |
#10 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Unless a book has an infinite number of chapters and links it hardly needs an id which is so long and random. Part of the anchor text if any would help to identify it, 2-4 words would distinguish it from others in any given chapter.
I just had to do this with a bunch of ids generated for headings and I had to write down a list and there was a duplication of the last two numbers, believe it or not, so I got them wrong and had to fix them. |
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,568
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Meaningful = manual
|
![]() |
![]() |
![]() |
#12 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
|
|
![]() |
![]() |
![]() |
#13 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
2. I don't think Sigil's approach is perfect either, but it is easier to understand, and if necessary do some RegEx on it (never sure why all the nested div's, but I'm only in 2nd grade at the CSS school) Code:
<body> <div class="sgc-toc-title"> Table of Contents </div> <div class="sgc-toc-level-1"> <a href="../Text/the_text.xhtml">Section A heading</a> <div class="sgc-toc-level-2"> <a href="../Text/the_text.xhtml#sigil_toc_id_1">Chapter 01 heading</a> <div class="sgc-toc-level-3"> <a href="../Text/the_text.xhtml#sigil_toc_id_2">Topic 01.01 heading</a> </div> <div class="sgc-toc-level-3"> <a href="../Text/the_text.xhtml#sigil_toc_id_3">Topic 01.02 heading</a> </div> <div class="sgc-toc-level-3"> <a href="../Text/the_text.xhtml#sigil_toc_id_4">Topic 01.03 heading</a> </div> </div> <div class="sgc-toc-level-2"> <a href="../Text/the_text.xhtml#sigil_toc_id_5">Chapter 02 heading</a> <div class="sgc-toc-level-3"> <a href="../Text/the_text.xhtml#sigil_toc_id_6">Topic 02.01 heading</a> </div> @DiapDealer "Meaningful = manual" Yes 100% correct, but if the program can do most of the heavy lifting, the remaining part is much less onerous. |
|
![]() |
![]() |
![]() |
#14 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,568
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Sigil's method was also part of the overhead in performance. All links had to be verified upon opening. Whatever algorithm was used for IDs had to remain resident in memory and tracked for each page to ensure uniqueness. It needed to know what came before so it could generate what should come next. It's unnecessarily complex for the ridiculously simply purpose these fragments/ids serve, in my opinion.
The UUID method, while maybe slightly aesthetically unpleasing, has the benefit of just plain working--with almost zero overhead--for every single book, every single time. No matter the length/complexity, or how many times a file might be split/merged/re-split/remerged without fail ... and dead-nuts simple. Generate a UUID (any UUID) and BAM! you're done. Unique. Forever (unless someone manually copies and pastes). I'd choose that method if I was writing the code to automate this sort of thing for all users/all books/all the time/every time. It'd be foolish not to. I do understand not liking "how it looks", though. But then again, I usually work with books where every link can always point to the top of a new file anyway. No frag/id required. ![]() Last edited by DiapDealer; 05-02-2014 at 07:56 PM. |
![]() |
![]() |
![]() |
#15 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
I work with books with multiple divisions in a single chapter file, so it would be nice to have ids which were autogenerated along the lines of the first few letters of each word.
"In the Winter Line" becoming id="inthewint" makes it easier to make sure what refers to what in an html toc which some of them have. That is where the issue is for me. It doesn't matter for the other toc which the editor and Sigil handle for me. But I have taken to giving them ids as I am going through since it seems to be an issue. I didn't know that I could put the id statement in the header. But since the editor does it I can do it just after I wrap the header tags around it. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Retaining inline CSS in <img> tags | cabz | Conversion | 1 | 06-21-2013 12:13 AM |
Inline TOC from toc.ncx | elmago79 | Kindle Formats | 38 | 03-25-2011 12:56 PM |
Use Regex to Code an Inline TOC, from an External TOC's .ncx File | mostlynovels | ePub | 2 | 03-16-2011 12:15 PM |
Tags around inline TOC links | jhempel24 | Sigil | 0 | 01-08-2011 06:21 AM |
Trying to make an Inline TOC | crutledge | Sigil | 2 | 05-09-2010 05:46 AM |