Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 04-25-2012, 06:38 AM   #1
jhsrennie
Member
jhsrennie began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Jun 2011
Device: Android
Can't get --level2-toc to work

I'm trying to convert an HTML file to epub and while the level 1 contents is working I can't make the level 2 contents work. A typical exerpt from my document is:

Code:
<h1 class="chapter">ALTERNATE TECHNOLOGY</h1>
<h1></h1><h3 class="subheading">Split Infinities</h3>
<p>Welcome to your new ARNS Home Universe GeneratorTM 3.6.4! Those ...p>
The command I'm using is:

Code:
ebook-convert "Ira Nayman - Luna for the Lunies.html" .epub --authors "Ira Nayman" --title "Luna for the Lunies" --cover "Ira Nayman - Luna for the Lunies.jpg" --level1-toc //h:h1[@class="chapter"] --level2-toc //h:h3 --input-encoding cp1252
I originally used --level2-toc //h:h3[@class="subheading"] and when that didn't work I tried --level2-toc //h:h3, but I would like to restrict it to the subheading class if I can.

Calibre correctly detects and builds all the level 1 contents, but I get no level 2 contents. If anyone can spot my deliberate mistake I'll be eternally grateful!
jhsrennie is offline   Reply With Quote
Old 04-25-2012, 12:31 PM   #2
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,835
Karma: 4199513
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
I don't use the commandline interface myself, but does it help if you add a --chapter option? e.g. something like
--chapter //*[name()='h1' or name()='h3']
jackie_w is offline   Reply With Quote
 
Enthusiast
Old 04-26-2012, 01:45 AM   #3
jhsrennie
Member
jhsrennie began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Jun 2011
Device: Android
Quote:
Originally Posted by jackie_w View Post
I don't use the commandline interface myself, but does it help if you add a --chapter option? e.g. something like
--chapter //*[name()='h1' or name()='h3']
Thanks, I'll give this a try just to see what happens, but I have <h1> tags that I don't want included in the TOC.
jhsrennie is offline   Reply With Quote
Old 04-26-2012, 02:02 AM   #4
jhsrennie
Member
jhsrennie began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Jun 2011
Device: Android
Quote:
Originally Posted by jhsrennie View Post
Thanks, I'll give this a try just to see what happens, but I have <h1> tags that I don't want included in the TOC.
Code:
--chapter //*[@class='subheading' or @class='subheading']
builds the TOC with all the entries I want, but they're all top level and I want the subheadings to appear as the second level in the TOC.
jhsrennie is offline   Reply With Quote
Old 04-26-2012, 06:29 AM   #5
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,835
Karma: 4199513
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
My Xpath knowledge is poor but can you find a way to construct an expression which combines your level1 toc Xpath and level2 toc Xpath in an either/or Xpath expression and put it in the --chapter setting.

Alternatively, you could cheat! Create the epub with all the correct TOC entries at a single level, then edit the .ncx file (either manually or using a utility like Nigol's epubfixer utility) to nest the entries correctly and/or remove any unwanted entries.
jackie_w is offline   Reply With Quote
Reply

Tags
contents

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ToC doesn't work on my Kindle BeccaPrice Conversion 4 10-31-2011 10:33 PM
it work's, but the toc isn't right schuster Recipes 12 06-10-2011 03:16 PM
How does the TOC editor work? Kivgaen Sigil 31 06-25-2010 10:28 AM
HELP, how do i make the TOC work in Ebook Publisher. Lago Fictionwise eBookwise 7 03-07-2010 08:08 PM
Getting TOC to work? enarchay Sony Reader 11 05-28-2009 05:46 AM


All times are GMT -4. The time now is 11:17 PM.


MobileRead.com is a privately owned, operated and funded community.