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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-19-2010, 05:47 PM   #1
tecgeo
Junior Member
tecgeo began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad and kindle3
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?
tecgeo is offline   Reply With Quote
Old 09-19-2010, 05:53 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,877
Karma: 4200035
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
You could have your HTML look something like:
Code:
<h1 class="invisible">Chapter 1</h1>
and your CSS something like:
Code:
.invisible {display: none}
Then "Chapter 1" would appear in the TOC but not the book text.
jackie_w is offline   Reply With Quote
 
Advertisement
Old 09-19-2010, 06:03 PM   #3
tecgeo
Junior Member
tecgeo began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad and kindle3
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.
tecgeo is offline   Reply With Quote
Old 09-19-2010, 06:41 PM   #4
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,877
Karma: 4200035
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
Quote:
Originally Posted by tecgeo View Post
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 CSS, if there is any, may be in your HTML file at the top, in the <head>...</head> section between <style>...</style> tags.

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:
Originally Posted by tecgeo View Post
I was hoping there was a way to grab the existing title value and stick it in the ToC.
Do you mean your HTML headings look something like this?
Code:
<h1 title="Chapter 1"></h1>
If so, there may be an easy way for Calibre to deal with them but unfortunately I don't know what it is. Maybe someone more expert will be able to help.

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.
jackie_w is offline   Reply With Quote
Old 09-19-2010, 06:59 PM   #5
tecgeo
Junior Member
tecgeo began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad and kindle3
Quote:
Originally Posted by jackie_w View Post
Do you mean your HTML headings look something like this?
Code:
<h1 title="Chapter 1"></h1>
If so, there may be an easy way for Calibre to deal with them but unfortunately I don't know what it is. Maybe someone more expert will be able to help.
That is exactly how they appear in my HTML source. I am using Wordpad to edit the HTML file to make the Chapter title text visible to Calibre. It is slow. I guess I will have to study about CSS use to see if that can help me.

You've been very helpful. Thanks again.
tecgeo is offline   Reply With Quote
Old 09-19-2010, 08:26 PM   #6
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,071
Karma: 5939999
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by tecgeo View Post
That is exactly how they appear in my HTML source. I am using Wordpad to edit the HTML file to make the Chapter title text visible to Calibre. It is slow. I guess I will have to study about CSS use to see if that can help me.

You've been very helpful. Thanks again.
Import with Sigil. It makes H1 top layer TOC H2 next in the nest...
Watch out for wordpad.
Notepad++ is a great replacement for (Windows) Notepad (and it is free)
theducks is online now   Reply With Quote
Old 09-21-2010, 09:44 PM   #7
tecgeo
Junior Member
tecgeo began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jun 2009
Location: Vancouver, Canada
Device: iphone, iPad and kindle3
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.
tecgeo is offline   Reply With Quote
Reply

Tags
calibre, convert, html, toc

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
iPod Which generation? lene1949 Apple Devices 5 10-19-2011 09:02 PM
How to force TOC generation out of scanned PDF magphil Calibre 5 10-01-2009 05:53 PM
Creator Issue with Cover and TOC? S3NTYN3L Kindle Formats 20 07-26-2009 12:50 PM
Making a TOC for LRFs? Issues with Calibre + LRF TOC editor not working Magitek LRF 0 05-06-2009 02:25 PM
My Digital Generation pda247 Writers' Corner 2 03-03-2009 01:25 AM


All times are GMT -4. The time now is 06:59 PM.


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