![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
Fix TOC that points to wrong chapter?
Somehow, after multiple conversions between formats using Calibre, the TOC in a well-formatted book now always points to one chapter prior to where it is supposed to point. I'd like to fix this but am not entirely sure how. I tried putting header tags around the chapter titles in the hopes that that would allow Sigil to auto-detect the chapter titles, but not only is that very tedious (70-odd chapter book), but it also puts a break in the middle of the title, so the title takes up multiple lines. Is there a way to simply redirect where the links in the TOC point? Also, if I do this will I be safe when I convert from epub back to mobi using Calibre again? Thanks!
|
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
I'm not sure entirely what you mean, but I can tell you that when I press f7, the TOC editor does not recognize any chapters.
|
![]() |
![]() |
![]() |
#4 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
That also tells me that the problem you see is with the Inline type, which is just another book page. Sorry, I don't know how to do math (to do digit adjustment) with REGEX If your paste one of your chapter headings (Entire line with tags, copied in Code View ), I might be able to suggest a REGEX for S&R that fould convert those to H# tags that Sigil will use for the standard TOC. Then after that is working AND SAVED, if there is no special reason to keep the inline TOC, delete that (via the book browser) if it is a separate file. Calibre can generate a new one from the EPUB, on conversion to Mobi. |
|
![]() |
![]() |
![]() |
#5 | ||
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
Quote:
EDIT: The line that is red is the actual chapter header. Quote:
Last edited by lunixer; 07-24-2011 at 04:34 PM. |
||
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Do a search for <p class="calibre2"> to be sure that the only usage is in the Chapter Headers
Code:
Search: <p (class="calibre2">.+)</p> Replace: <h3 \1<</h3> Press F7 to see if the TOC has that correct Abort the edit if wrong. change to All HTML and find next, Replace All F7 to check ![]() Anything that is wrong in the files should be looked at and edited back to <p ... </p>, |
![]() |
![]() |
![]() |
#7 | ||||
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
Quote:
Quote:
Quote:
Quote:
Anyway, thanks! |
||||
![]() |
![]() |
![]() |
#8 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I see the error
![]() it should be: Replace: <h3 \1</h3> The way this pattern works: Search for any line starting with <p class="calibre2"> and ending with </p> The stuff between the ( ) will be remembered, which will bring along any ID values. the replace puts a <h3 in the spot that was the <p that is followed by all the stuff remembered (the \1) finally we want to end the line with a </h3> (not the <</h3> I stuttered) |
![]() |
![]() |
![]() |
#9 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
because it was not a pair, it looked for something with a )</p> which is not there Patterns are exacting ![]() |
|
![]() |
![]() |
![]() |
#11 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
Could you please type out exactly what should be in find? I copied/pasted the expression from your first post so I am unclear exactly what I should be using. Once again, thank you for the help.
|
![]() |
![]() |
![]() |
#12 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() Use the corrected replace Last edited by theducks; 07-26-2011 at 08:25 PM. |
|
![]() |
![]() |
![]() |
#13 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Code:
Search: <p (class="calibre2">.+)</p> Replace: <h3 \1</h3> ![]() I cant see your code , is there a calibre2 in the chapter title Last edited by theducks; 07-26-2011 at 08:26 PM. |
|
![]() |
![]() |
![]() |
#14 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 231
Karma: 928
Join Date: Aug 2010
Device: Kindle 3
|
Quote:
Code:
<body class="calibre" id="filepos178"> <div class="calibre1" id="filepos50625"> <p class="calibre2"><a class="calibre8" href="../Text/Priestess_of_the_White_split_003.html#filepos1441"><span class="calibre5 bold calibre9">1</span></a></p><br class="calibre4" /> <br class="calibre4" /> |
|
![]() |
![]() |
![]() |
#15 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I pasted your code into Sigil 3.4 and My terms into the S&R.
I then Searched. Verified what it found... Then I clicked Replace ![]() you can see the results |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can someone tell me how to fix this? Downloaded wrong format? | Aspen | General Discussions | 19 | 12-22-2010 05:55 PM |
Calibre settings for using 'chapter' in TOC | TargonD | Calibre | 13 | 11-03-2010 08:57 PM |
ADE and long chapter names in ToC | frabjous | Reading and Management | 3 | 08-14-2009 11:16 AM |
Chapter or TOC Creation help needed | gandor62 | Calibre | 4 | 04-15-2009 02:18 PM |
html2epub TOC and chapter detection help | ilovejedd | Calibre | 6 | 02-22-2009 05:58 PM |