Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 09-18-2011, 04:34 PM   #1
NMinker
Junior Member
NMinker began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Sep 2011
Device: iTouch
Question 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'))]
The current detection code doesn't detect chapters properly.

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.
NMinker is offline   Reply With Quote
Old 09-18-2011, 05:59 PM   #2
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
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.
user_none is offline   Reply With Quote
Old 11-01-2011, 11:30 AM   #3
JohnnyNonsense
Junior Member
JohnnyNonsense began at the beginning.
 
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.
JohnnyNonsense is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 07:44 AM.


MobileRead.com is a privately owned, operated and funded community.