Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-26-2012, 02:22 PM   #1
memenow
Junior Member
memenow began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2012
Device: nook
How to automatically create chapter titles and breaks in an epub file?

I have a big file that is separated into categories with an underscore beneath each category name. The file is constantly changing and there are 80 categories. It is a plain text file. I would like to make it so that each category name is a separate chapter in an epub file. I would also like to make sure each chapter name is the title of the chapter. Is there a way to do this automatically with Calibre? Maybe some regex magic? For example, I would like the chapter titles for the categories below to be: Fruit, Vegetables, Herbs. And I would like it to be parsed automatically (one way to do this would probably involve recognizing the underscores in a regex expression). How can I do this?


Fruit
________
Apples
Bananas

Vegetables
____________
Cucumbers
Zucchini

Herbs
_____
thyme
cayenne
memenow is offline   Reply With Quote
Old 11-26-2012, 03:09 PM   #2
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,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by memenow View Post
I have a big file that is separated into categories with an underscore beneath each category name. The file is constantly changing and there are 80 categories. It is a plain text file. I would like to make it so that each category name is a separate chapter in an epub file. I would also like to make sure each chapter name is the title of the chapter. Is there a way to do this automatically with Calibre? Maybe some regex magic? For example, I would like the chapter titles for the categories below to be: Fruit, Vegetables, Herbs. And I would like it to be parsed automatically (one way to do this would probably involve recognizing the underscores in a regex expression). How can I do this?


Fruit
________
Apples
Bananas

Vegetables
____________
Cucumbers
Zucchini

Herbs
_____
thyme
cayenne
Use Sigil (Where you ca see the code and see the test results before you save ('Discard' is my overworked friend )

The Keyword you are looking for is 'markup'
IMHO, if you are going to do that much work... Do it the Sigil (and REGEX) way: (?sm)<p (.+?)</p>\s+<hr
theducks is offline   Reply With Quote
Advert
Old 11-27-2012, 09:54 PM   #3
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,208
Karma: 16534692
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
You could add some simple 'Markdown' to your txt file like this (note the #'s):
Code:
##Fruit
________
Apples
Bananas

##Vegetables
____________
Cucumbers
Zucchini

##Herbs
_____
thyme
cayenne
and set Convert - TXTInput - Formatting style to markdown

Last edited by jackie_w; 11-27-2012 at 10:00 PM.
jackie_w is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to automatically create chapter titles and breaks in an epub file? memenow ePub 2 12-06-2012 02:01 PM
Chapter Breaks in .txt file on Kindle? BKh Workshop 3 05-10-2012 09:39 AM
reorgainse epub into 1 file per chapter cybmole Calibre 3 01-15-2011 07:24 AM
PRS-350 Breaks after Chapter Titles Rand Brittain Sony Reader 2 10-25-2010 12:53 PM
Automatically convert file to EPUB upon import into library astrodad Calibre 6 07-23-2010 12:22 PM


All times are GMT -4. The time now is 07:08 PM.


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