View Single Post
Old 06-22-2010, 05:13 PM   #7
st_albert
Guru
st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'
 
Posts: 698
Karma: 150000
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Valloric View Post
With Sigil, you wouldn't be able to use that markup to create a TOC. On a related note, using paragraph elements for headings with "h1" classes is... not a good idea. Far from it. It would be much simpler to just use
Code:
<h1> Heading 1</h1>
with the styles applied to the "h1" class applied for all h1 elements. This approach also uses nice semantic markup.

You could easily convert to this scheme with a regex search&replace operation.
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.
st_albert is offline   Reply With Quote