View Single Post
Old 07-09-2010, 02:22 AM   #9
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Thanks jackie_w, I couldn't have put it better. That's basically what I do, except that my starting documents are html or plain-text with markdown.

One other point to note is that you can also have TOC entries within a chapter. For example if you want <h4> tags to generate a Level 3 TOC, (to mark sections within a chapter), then add to step 4 above:

In [Convert] - [Table of Contents] set "Level 3 TOC" to //h:h4

but do NOT add h4 to the [Structure Detection] so it won't break the chapter.

Calibre has even more flexibility in this area because you can be selective about when a tag produces a TOC entry. For example you may want <h4 class="toc"> to produce an entry, but <h4 class="notoc"> not to. Just click on the Xpath helper button on [Table of Contents], and fill it in as follows:

[Match HTML...] h4
[Having the attribute] class
[With value] toc

I can post a simple html example if anyone is interested but I think that everything is pretty well covered now.

Last edited by Agama; 07-09-2010 at 02:29 AM.
Agama is offline   Reply With Quote