View Single Post
Old 10-17-2015, 04:49 PM   #3
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Quote:
Originally Posted by morgon View Post
Hi,

I would like to convert a plain (ascii) text file to epub and generate a toc.

As this is a text file xpath does not make much sense (at least to me), but I can construct a regext that allows chapters to be detected.

How can I teach calibre to use this regex to detect chapters when converting plain text to epub?

many thanks!
I think the controlling factor is any line of text that does NOT end with a period, or other sentence ender, will generate a bolded chapter title line on a fresh page and an entry in the auto-generated TOC
I know the above is true for lines consisting only of a number, or the word Chapter or Part followed by a single word or a number.
If the last character of such a line is a period it is treated as any other sentence in the text.
porphyry5 is offline   Reply With Quote