09-18-2011, 04:34 PM | #1 |
Junior Member
Posts: 1
Karma: 10
Join Date: Sep 2011
Device: iTouch
|
Converting txt to epub, chapter heading contains number
I'm sure this has been asked before, but using Google got me dead ends.
I'm using calibre to convert a txt to epub. And the chapter headings are just the chapter numbers (i.e. One, Two, Ten, Twenty-Three, etc). I'm using this code to detect chapters: Code:
//*[((name()='p') and re:test(., 'chapter', 'i'))] I need help to improve the code to work for my means, so I don't have to painfully add every chapter to the ToC. Thanks ahead for any help. |
09-18-2011, 05:59 PM | #2 |
Sigil & calibre developer
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
The xpath you're using looks for p tags which have the word chapter in them. This isn't going to work in your case because you're chapter headings are all numbers.
Try enabling Heuristic processing and only set the unformatted detect chapter heading option. It may be able to detect the heading due to the line length. |
11-01-2011, 11:30 AM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: Oct 2010
Device: none
|
You've probably figured out a solution by now, but one possible solution is to first annotate your text file with Markdown. This may be as simple as putting a single "#" before your title (to place it in an h1 tag), and a "##" before each chapter to put them in h2 tags.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issue with Sigil and chapter titles (Heading 2) | AprilHare | Sigil | 18 | 02-05-2020 08:14 PM |
How to avoid page break after heading/chapter | tkirke | ePub | 6 | 01-22-2010 02:12 PM |
Converting from txt to epub using defaults | p3aul | Calibre | 7 | 10-09-2009 07:23 PM |
html2epub: chapter splitting on more than 1 heading level | Portnull | Calibre | 1 | 06-25-2009 09:17 AM |
Controlling chapter heading sizes? | Djehuty | Calibre | 3 | 04-27-2009 08:02 PM |