09-19-2010, 04:47 PM | #1 |
Junior Member
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad, kindle3, Kobo Clara
|
ToC generation issue
I did some conversions recently and then imported the resultant HTML file into Calibre. Converting to epub was fine on several but a few had trouble identifying the Chapter headers. When I look at the HTML source the h1 tags do not contain any text but instead have a title attribute ="xxxxx" value between the tags. I can tediously type in the corresponding text between the h1 tags but this puts that Chapter Title text in the ebook when only a chapter break image existed previously. If I use the ToC filter assistant in calibre and specify h1 for the tag, title for the attribute and leave the value blank it generates the ToC with Unnamed for each of the Chapter names.
Does anyone know if there a filter value entry or Chapter detection Xpath expression to insert the actual text value of each h1 tag's title attribute so that the correct value shows up in the generated ToC and thereby keep the output clean and not introduce new text chapter headings? |
09-19-2010, 04:53 PM | #2 |
Grand Sorcerer
Posts: 6,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
You could have your HTML look something like:
Code:
<h1 class="invisible">Chapter 1</h1> Code:
.invisible {display: none} |
09-19-2010, 05:03 PM | #3 |
Junior Member
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad, kindle3, Kobo Clara
|
Thanks. I get the first part but I am not a programmer by vocation. Where do I find the CSS? Is that in Calibre somewhere?
The other problem is that this doesn't avoid the editing tedium in the HTML. If it works then great but I was hoping there was a way to grab the existing title value and stick it in the ToC. |
09-19-2010, 05:41 PM | #4 | ||
Grand Sorcerer
Posts: 6,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
Alternatively, it may be in an external .css file (often in the same dir as the HTML file). If this is the case then there will be a link in the <head>...</head> section at the top of the HTML file looking something like Code:
<link rel=stylesheet type="text/css" media=all href=xyz.css> Quote:
Code:
<h1 title="Chapter 1"></h1> In the meantime, if this was my file, I would open it in a good text editor (e.g. Notepad++) and use mass Find/Replace to convert the old format to the new using simple regular expressions. But this is only an option if you're comfortable with regular expressions. I would then re-import the new HTML into Calibre and convert as usual. |
||
09-19-2010, 05:59 PM | #5 | |
Junior Member
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad, kindle3, Kobo Clara
|
Quote:
You've been very helpful. Thanks again. |
|
09-19-2010, 07:26 PM | #6 | |
Well trained by Cats
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Watch out for wordpad. Notepad++ is a great replacement for (Windows) Notepad (and it is free) |
|
09-21-2010, 08:44 PM | #7 |
Junior Member
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad, kindle3, Kobo Clara
|
That solved the problem nicely "theducks". Thank you. Imported into Sigil and output the epub with ToC like a dream. Now I have another ebook editing program to play with... uh oh.
|
Tags |
calibre, convert, html, toc |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
iPod Which generation? | lene1949 | Apple Devices | 5 | 10-19-2011 08:02 PM |
How to force TOC generation out of scanned PDF | magphil | Calibre | 5 | 10-01-2009 04:53 PM |
Creator Issue with Cover and TOC? | S3NTYN3L | Kindle Formats | 20 | 07-26-2009 11:50 AM |
Making a TOC for LRFs? Issues with Calibre + LRF TOC editor not working | Magitek | LRF | 0 | 05-06-2009 01:25 PM |
My Digital Generation | pda247 | Writers' Corner | 2 | 03-03-2009 12:25 AM |