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, 05: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
Advert
Old 09-18-2011, 06: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: 1054509
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, 12:30 PM   #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 11 11-15-2011 10:49 AM
How to avoid page break after heading/chapter tkirke ePub 6 01-22-2010 03:12 PM
Converting from txt to epub using defaults p3aul Calibre 7 10-09-2009 08:23 PM
html2epub: chapter splitting on more than 1 heading level Portnull Calibre 1 06-25-2009 10:17 AM
Controlling chapter heading sizes? Djehuty Calibre 3 04-27-2009 09:02 PM


All times are GMT -4. The time now is 05:53 PM.


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