![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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> Code:
<hr class="sigilChapterBreak" /> <h2>This is a Chapter Name</hr> 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> 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. |
![]() |
![]() |
![]() |
#2 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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> |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 61
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> |
![]() |
![]() |
![]() |
|
![]() |
||||
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 | 0 | 07-18-2006 10:31 AM |