02-02-2011, 08:22 PM | #1 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jan 2011
Location: Los Angeles, CA
Device: Kindle Paperwhite 2.0, Nook Color
|
LIT to EPUB TOC problem
Hi there! I've been using Calibre for a few weeks now to convert books to EPUB since my eReader only accepts EPUB. I haven't had too many problems. Today, though, this happened:
I downloaded a copy of "To Kill A Mocking Bird" that was in LIT format since that was all I could find. When I look at the original file in the Calibre e-Book Viewer, it looks LIKE THIS. However, after converting to EPUB, it looks LIKE THIS. It suddenly goes from no TOC to having the chapters indexed, but they are all listed as "Unnamed". I tried selecting "Force use of auto-generated Table of Contents" in the "Table of Contents" part of the conversion, bit it produce basically the same thing. This time, though, it had the chapters properly indexed, but also a 2nd set of marks all called "Unnamed". So, double index. Any help to fix this would be greatly appreciated. -Myles |
02-02-2011, 08:56 PM | #2 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Are those un-named TOC items actually chapters?
It would help if we could see the html code from a single chapter heading. The easiest way to grab that is to use the 'Search and Replace' feature. Click the little magic wand button and scroll through the html code until you see the first chapter and just copy a few lines - the heading and a couple lines around it. You can also try the 'markup chapter headings' in Heuristics, but based on what you're seeing I'm not sure if it would work. |
02-02-2011, 09:30 PM | #3 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jan 2011
Location: Los Angeles, CA
Device: Kindle Paperwhite 2.0, Nook Color
|
Yeah. The "Unnamed" chapters each lead to each of the actual chapters and they're in order. It's the same when I do the "Force" option.
|
02-02-2011, 09:41 PM | #4 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jan 2011
Location: Los Angeles, CA
Device: Kindle Paperwhite 2.0, Nook Color
|
Okay, I went to "Tweak ePub", and uploaded it to my website, <Link deleted by Mods>.
Last edited by ldolse; 02-02-2011 at 11:17 PM. |
02-02-2011, 11:26 PM | #5 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Posting links to copyrighted content on these forums will get you banned, thats why I asked you to use the wizard and just post a few lines of html. Please don't do that again.
Anyway, here is the content I asked you for: Code:
<div class="chapter" id="calibre_toc_9"></div><div class="calibre1"><h3 class="calibre6"><a name="ch05" class="calibre9" id="ch05">5</a> <br class="calibre3"/><br class="calibre3"/><br class="calibre3"/></h3></div><p class="fl1">My nagging got the better o If you look at your chapter headers, you can see they're just numbers. When you look through the html code you can see these are referenced in '<h3>' heading tags: Code:
<h3 class="calibre6"><a name="ch05" class="calibre9" id="ch05">5</a> <br class="calibre3"/><br class="calibre3"/><br class="calibre3"/></h3> Code:
//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\s+', 'i')) or @class = 'chapter'] So we can just change that xpath to this: Code:
//*[((name()='h1' or name()='h3') and re:test(., '\d+', 'i')) or @class = 'chapter'] If all the chapter tags in the book are h3 tags, you could also click on the little magic wand icon next to the xpath, and just type 'h3' into the first box - even simpler. Last edited by ldolse; 02-02-2011 at 11:31 PM. |
02-03-2011, 12:18 AM | #6 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jan 2011
Location: Los Angeles, CA
Device: Kindle Paperwhite 2.0, Nook Color
|
Sorry about that! I'll remember in the future.
Thanks for your help. This fixed the problem! |
02-04-2011, 04:49 PM | #7 |
Junior Member
Posts: 3
Karma: 10
Join Date: Jan 2011
Location: Colorado
Device: IPad Air
|
ldolse
Thank you so much for your explanation. I have also been struggling to get the ToC to appear when converting various formats to mobi, even trying Sigil, when what I needed was your advice to click the magic wand in S&R to find the right heading that begins the chapter you want to show in the ToC. Most of mine have been simple h3 in the level 1 but it is good to know various codes in the x-path like the one you offered "//*[((name()='h1' or name()='h3') and re:test(., '\d+', 'i')) or @class = 'chapter']" can be used for more complex structures. I'm still only a week into learning calibre but have already fallen in love with its versatility and usefulness in conjunction with the Kindle. As well as the helpfulness of the members of this forum. Thanks again, Doug |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ePub TOC to mobi TOC | edmnddntes | Conversion | 5 | 01-24-2011 02:56 AM |
Lit to Epub... Problem and can't fix? | jotekman | Calibre | 6 | 09-10-2010 04:12 AM |
ePub with eCub -- Import problem of .lit | Rafardeon | ePub | 8 | 04-10-2010 11:47 PM |
lit to epub problem | Chris2k | Calibre | 5 | 02-19-2010 06:00 AM |
lit to epub - indenting question, & an eject problem | wygit | Calibre | 3 | 11-14-2009 10:49 AM |