Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 46773

Help with chapter detection

$
0
0
Hi,

I try to convert a rtf to epub and would like calibre to detect the chapters by regex.

The chapters are easily identified by starting with the chapter number, then a dot, followed by the chapter name in captitals (apart from A-Z the only character appearing in chapter names is an apostrophe.

So I use this:

Code:

//*[re:test(., "^\d+\. [ 'A-Z]+$")]
And this works - all chapters are detected but the problem I am having is that each chapter is added to the TOC twice.

Why is that?

Can anybody suggest a solution so that each chapter only appears in the TOC once?

Many thanks!

Viewing all articles
Browse latest Browse all 46773

Trending Articles