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 04-08-2012, 03:20 AM   #1
franc
Connoisseur
franc began at the beginning.
 
Posts: 68
Karma: 10
Join Date: Feb 2010
Device: none
Making chapter from textfiles

Hello

is it possible to define chapters when I convert a textfile to epub?
I only found some XPath definitions and html-tags to find chapters, but not the possibility to define some RegEx to find a chapter.

E.g. I have this:

Quote:

*** chapter one ***

blablablablabla
blabla
and so on

++++++++++++++++

*** chapter two ***

blabla bla blabla
blabla and so on...

++++++++++++++++
Either I could find the + or better the *** to define a chapter.
Best would be some:

Code:
\*\*\* ([-\w\x20()]+) \*\*\*
to find the chapters name (\1) and tell it to calibre.
Is something like this possible for textfiles?

I tried it with html-files (zip-files for calibre only) and I could define the chapters, but I stopped, when I noticed, calibre isn't able to detect linebreakes (br), e.g.:
Quote:
blablabla<br />blablabla<br />blablabla<br />
is after conversion to epub just:
Quote:
blablabla blablabla blablabla
and not:
Quote:
blablabla
blablabla
blablabla
frank
franc is offline   Reply With Quote
Old 04-08-2012, 11:03 AM   #2
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Use Markdown or Textile to mark your chapter headings, e.g.
Code:
Title
======

## Chapter 1
## Chapter 2
Then change your chapter xpath under structure detection to use only h1/h2 tags:
Code:
//*[name()='h1' or name()='h2']
If you don't want to edit the text files give heuristics a shot, it will find them automatically for a lot of cases.
ldolse is offline   Reply With Quote
Old 04-08-2012, 04:39 PM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,763
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Calibre normally looks for headings the begin with:
Chapter
Book
Section
Part

See 'Structure Detection' in Conversion or Preferences Common options
theducks 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
Ebook chapter titles: with or without chapter number? amoroso Writers' Corner 16 06-14-2011 06:35 AM
What are SGF Chapter Marker and Chapter Break? webphone Sigil 1 05-25-2011 02:43 PM
Calibre making unwanted chapter breaks PatNY Calibre 6 10-08-2010 09:58 PM
Next Chapter skips to End in last chapter? JoGoCo Kobo Reader 5 07-13-2010 09:23 PM
K2 v K1: Chapter-to-chapter missing from some books? Starhawk Amazon Kindle 4 03-10-2009 06:27 PM


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


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