View Single Post
Old 06-01-2010, 07:08 PM   #5
Stinger
Asha'man
Stinger has learned how to read e-booksStinger has learned how to read e-booksStinger has learned how to read e-booksStinger has learned how to read e-booksStinger has learned how to read e-booksStinger has learned how to read e-booksStinger has learned how to read e-books
 
Stinger's Avatar
 
Posts: 335
Karma: 844
Join Date: May 2010
Location: Canada
Device: Kobo
Yeah, since you converted from a txt file, those tags are not present, which make auto-generating the TOC pretty simple.

Quote:
CHAPTER ONE There was a faint smell of oil, turpentine and beeswax in the shop
From this is looks like there isn't even a paragraph break between 'Chapter One' and that first sentence, which is just a bitch. You might be forced to manually open up the epub in Sigil, add a line break after the chapter heading, and then change the style of that heading to 'Heading #'. (You can't expect much from converting a plain text file).

However, since 'CHAPTER ONE' is capitalized, there might be a XPATH statement that could key to all caps, and the word Chapter. Alas, the complexities of XPATH is something I'm still trying to learn myself, so hopefullt someone more versed in that will pipe in here.

Quote:
I wondered if there should be anything in the "TOC Filter, Level 1 TOC (xpath Expression):" Fields. 1,2,3 are blank.
If you leave those fields blank, Calibre will use the default XPATH, which won't work for you since you have no H1 or H2 tags around your chapter headings. This is from the Calibre user manual talking about the default chapter detection it uses:

Quote:
By default, calibre uses the following expression for chapter detection:

//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\s+', 'i')) or @class = 'chapter']

This expression is rather complex, because it tries to handle a number of common cases simulataneously. What it means is that calibre will assume chapters start at either <h1> or <h2> tags that have any of the words (chapter, book, section or part) in them or that have the class=”chapter” attribute.

Last edited by Stinger; 06-01-2010 at 07:11 PM.
Stinger is offline   Reply With Quote