08-27-2010, 09:53 AM | #1 |
Member
Posts: 11
Karma: 10
Join Date: Aug 2010
Device: none
|
An auto-toc problem
Hello all,
I am relatively new to Calibre. I have a html file I wish to convert to epub format. It has an inline toc, but I also would like to create an auto-generated one. The book has chapters and parts which encapsulate the chapters, thus I have set parts to be heading level 1, while chapters as level 2. I also have a batch file, which uses ebook-convert to add the detection of heading 1 and 2, thus Calibre can generate the multi-level toc. However, the problem is that if I specify --level1-toc and the --level2-toc options as //h:h1 and //h:h2 respectively, Calibre auto-generates a toc which is based on the 2nd level headings only, i.e. the heading 1 parts are missing. Here's how my command looks like: Code:
ebook-convert %1 %2 --level1-toc //h:h1 --level2-toc //h:h2 --use-auto-toc Could anyone explain what I'm missing here please? Erion |
08-27-2010, 10:15 AM | #2 |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Hi erion, Welcome to the forum.
I use the GUI so I'm not a commandline expert, but I think you're missing a --chapter conversion option. In the GUI to detect chapters at <h1> or <h2> you need this code: Code:
//*[name()='h1' or name()='h2'] Code:
--chapter "//*[name()='h1' or name()='h2']" (I get confused with quotes usage on the commandline, so apologies if I haven't got it exactly correct) Last edited by jackie_w; 08-27-2010 at 10:17 AM. |
Advert | |
|
08-27-2010, 11:15 AM | #3 |
Member
Posts: 11
Karma: 10
Join Date: Aug 2010
Device: none
|
Hi,
This seems to solve my problem wonderfully. The question is though, if I specify the xpaths for the multi-level contents, how come they are not used... seems a mystery to me. Anyways, thank you very much for your quick reply and your solution, it's really appreciated. Time to look for an epub auto tagger... Cheers, Erion |
08-27-2010, 12:34 PM | #4 | |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
For instance, (at least in the GUI) if you run your conversion with just the --chapter option set as specified and leave the --level-tocs blank then you still get all the <h1>s and <h2>s in the epub TOC, but they have a flat hierarchy instead of the <h2>s being children of the <h1>s. So it appears that the --level-tocs fine-tune the --chapter. If I've got this completely wrong maybe someone more technical can chip in and enlighten us. |
|
08-27-2010, 12:37 PM | #5 |
creator of calibre
Posts: 44,565
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
IIRC the toc level options, if specified (and if they match) take precedence.
|
Advert | |
|
08-27-2010, 12:42 PM | #6 |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Thanks for quick response. So it seems I've got things the wrong way round. You learn something new every day.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Email auto transfer problem | JimKelly | Calibre | 24 | 01-24-2011 10:25 PM |
How not to auto-generate TOC in Calibre -setting? | Jundle | Calibre | 0 | 05-05-2010 03:53 AM |
TOC Problem | Zipr | Calibre | 0 | 03-19-2010 06:01 PM |
Kindle on IPod auto-rotate problem | hbreder | Amazon Kindle | 3 | 02-12-2010 02:20 PM |
Why HTML2LRF auto create 1 row TOC ? | alophind | Sony Reader | 0 | 02-04-2008 02:44 AM |