07-20-2009, 05:13 PM | #1 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jul 2009
Device: stanza
|
Problem generating TOC
Hi,
I've having trouble getting calibre to generate the table of contents converting from an rtf file to a epub. It's correctly detecting the chapters because if I open the epub file, i have a separate index_split_X.html/xhtml file for each one. But the table of contents button in calibre reader is disabled and the toc.ncx has an empty navMap. I've tried setting the chapter threshold to more chapters than the book has in the conversion settings, but that didn't help. Searched the user manual, the FAQ, Google, and this forum, but I've come up empty. What could I be missing? I've tried 0.5.14 and 0.6.0b15. Thanks. |
07-20-2009, 05:26 PM | #2 |
creator of calibre
Posts: 44,535
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
try enabling the option to force use of auto generated TOC
|
Advert | |
|
07-20-2009, 05:40 PM | #3 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jul 2009
Device: stanza
|
|
07-20-2009, 09:22 PM | #4 |
creator of calibre
Posts: 44,535
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Look at the conversion log to see why there is no TOC
|
07-20-2009, 11:07 PM | #5 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jul 2009
Device: stanza
|
Ok, my fault. I was misunderstanding how it detects chapters. I'm still learning how the tool works. :-)
Is it possible to specify a regex instead of a xpath? For example, I'd like detect chapters with a regex like /^Chapter [0-9]*$/. This would save me from having to go into every file i want to convert and manually setting styles. |
Advert | |
|
07-21-2009, 01:23 AM | #6 |
creator of calibre
Posts: 44,535
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
XPath supports regexp based matching on content read the Xpath tutorial in the User Manual
|
07-21-2009, 03:30 AM | #7 |
Junior Member
Posts: 8
Karma: 10
Join Date: Jul 2009
Device: stanza
|
Thanks a lot for your help.
I understand xpaths, but I don't know how you apply them to a rtf file. Is that documented somewhere? All the chapters in my rtf file start with a line that says "Chapter 1", etc. Just experimenting, I tried the following xpath, but it throws a conversion error if I use a star instead of a specific tag. But if I give it a specific tag, it doesn't work (since I have no idea what tag matches an arbitrary line of text). //*[re:test(., 'chapter [0-9]*', 'i')] |
07-21-2009, 12:19 PM | #8 |
creator of calibre
Posts: 44,535
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
07-21-2009, 04:25 PM | #9 | |
Junior Member
Posts: 8
Karma: 10
Join Date: Jul 2009
Device: stanza
|
Quote:
I probably should have mentioned that I read the XPath tutorial the first time you pointed me to it. I had originally overlooked it because I thought it was something that only applied to html/xml, and I had a rtf file. I still haven't come across any docs on how to apply an XPath to rtf (e.g. what's the structure and tag/attribute names as they relate to XPath?). In the XPath tutorial, under "Selecting by tag content", the example is only looking at h2 tags. How do you look at lines that have no style applied? If I try to use a '*' instead of h2, I get a conversion error. Thanks again for your help. :-) |
|
07-21-2009, 06:19 PM | #10 |
creator of calibre
Posts: 44,535
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre converts every input format internally to HTML. The HTML is then converted to the output format. All content will be in some tag or the other, you just have to figure out what tagit is. You can do that easily enough by converting to epub, unzipping the epub and looking at the HTML
|
09-07-2015, 12:50 AM | #11 |
Junior Member
Posts: 1
Karma: 10
Join Date: Sep 2015
Device: kindle
|
Problem with edit toc
Hi Kovid and Fellows,
I'm trying to edit the table of contents of a document converted from docx to azw3, but nothing happens when the edition is complete: the respective html file remains the same and no change takes effect. However, the changes made still remain in the toc editor when the document (azw3) is reopened. What happens? Tank you DVK |
09-07-2015, 12:53 AM | #12 |
creator of calibre
Posts: 44,535
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The table of contents you are editing is in the ncx file not the html file. HTML table of contents need to be edited manually.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with TOC | bobcdy | Sigil | 3 | 07-23-2010 05:09 PM |
Generating TOC entries for prelims / end matter in InDesign | forlor | ePub | 7 | 07-07-2010 09:26 AM |
Trouble generating a TOC | foghat | Calibre | 2 | 05-07-2010 07:00 PM |
Problem with TOC | Soxendom | OpenInkpot | 4 | 10-28-2009 02:47 PM |
Problem with TOC | Soxendom | Calibre | 2 | 10-28-2009 01:12 PM |