View Single Post
Old 06-22-2010, 07:46 PM   #8
Kivgaen
Enthusiast
Kivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enoughKivgaen will become famous soon enough
 
Kivgaen's Avatar
 
Posts: 38
Karma: 608
Join Date: Aug 2009
Location: Toronto
Device: all devices
Quote:
Originally Posted by st_albert View Post
That is how I do it with epubs exported from indesign ID4. I unpack the ID4 epub, which contains the whole book as a single .xhtml file, and do various clean-up before feeding it to sigil. For the above example, you could do something like:

search for: <p class="h1"> (Heading\s\n+?)</p>

replace with: <h2>\0</h2>

where "\0" refers to whatever is in parenthesis in the search string. Note that sigil uses \1 for the first set of parentheses, and a checkbox for minimal search instead of the perl "?". My example uses the syntax of the bluefish html editor.

Then, in the stylesheet, create a style for h2 that is a copy of the style specified by p.h1 (in this example. YMMV). If you've just replaced all of the <p class="h1"> tags, you can remove the p.h1 style from the stylesheet.

While I'm at it, I do other cleanup tasks that are best done globally, like insert sigil chapter-break marks, etc. and then re-zip the original epub and feed it to sigil for breaking up into chapters and any final polishing needed.
I don't understand what you are saying... if My chapter headings looked like this:

<p class="h1">1. The Other Minister</p>

<p class="h1">2. Spinner's End</p>

<p class="h1">3. Will and Won't</p>

etc...

Then I could do a global find and replace that would search for the first instance of <p class="h1">... and then grab all of the string between that and the closing </p> tag and plop it into the new <h1> tag?

If that's what you're saying, that's perfect...
Kivgaen is offline   Reply With Quote