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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 04-19-2011, 03:06 PM   #1
affa
Connoisseur
affa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheese
 
Posts: 56
Karma: 1234
Join Date: Apr 2011
Device: kindle
retagging chapter heads?

EDIT - solved this myself, second post in case someone needs it

I've spent the past 72 hours playing with Indesign, Sigil, and Calibre, trying to get my print books to a valid epub format with varying degrees of success.

I've run into a couple walls, the first of which is identifying chapters.

After exporting to Epub from Indesign (slightly simplified / rearranged from original print version), if I open the epub in Sigil I have one huge file and the chapter heads look like:

Code:
<p class="chapter-head"><span class="generated-style">This is a Chapter Name</span></p>
But if I understand everything correctly, and from reading this forum, it would be greatly preferable for them to be

Code:
<hr class="sigilChapterBreak" />
<h2>This is a Chapter Name</hr>
As this would then allow me to use Sigil to split on chapter breaks, properly divide my ebook up, and also generate a proper TOC.

Now, my problem is that while it's easy enough to search and replace the first half of that markup, the second half
Code:
</span></p>
isn't so simple because it's not unique and is found everywhere.

Is there any way to do a Regular Expression search/replace that will take the above markup, with some sort of wildcard for the chaptername, that will return the new markup with the original Chaptername? I figured out how to do this in GREP once for something else, but I'm currently just lost. Then, I can just run this search replace on all of my books, and it would be of massive help to me.

If someone has a completely alternate suggestion, I'm all ears as well, but this seems to be the quickest and makes the most sense. I'd even be ok with doing the search and replace using some other tool if necessary (unzipping the epub) but was hoping I could do it inside of Sigil for obvious reasons.

Last edited by affa; 04-19-2011 at 03:40 PM.
affa is offline   Reply With Quote
Old 04-19-2011, 03:37 PM   #2
affa
Connoisseur
affa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheeseaffa can extract oil from cheese
 
Posts: 56
Karma: 1234
Join Date: Apr 2011
Device: kindle
figured it out myself

SEARCH
<p class="chapter-head"><span class="generated-style">(.*)</span></p>

REPLACE
<hr class="sigilChapterBreak" /><h2>\1</h2>
affa is offline   Reply With Quote
Old 04-19-2011, 03:55 PM   #3
Faster
Connoisseur
Faster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of light
 
Posts: 60
Karma: 12096
Join Date: Sep 2010
Location: Tasmania
Device: Sony PRS 650
Here it is for ANY class and ANY span:

Code:
Find: <p[^>]*><span[^>]*>((Chapt|CHAPT)[^</]*)</span></p>

Replace: <hr class="sigilChapterBreak" /><h2>\1</h2>
Faster 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
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
Retagging PDF files for mobile devices RKramkowski PDF 0 07-18-2006 10:31 AM


All times are GMT -4. The time now is 03:55 AM.


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