View Single Post
Old 03-02-2011, 12:56 PM   #30
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Quote:
Originally Posted by cybmole View Post
i'm struggling to follow that code. as both hopen & \g are new to me.

but you are replacing the img alt tag with a title tag, I think ?

i picked out the chapter number with a regex and inserted it as text, in a small font, before the image. toc was OK then. not ideal but I can live with it.
so my code became
Code:
<h2 class="calibre10" id="heading_id_2">1 &nbsp; &nbsp; &nbsp;<img alt="[Chapter 1]" class="calibre11" src="../Images/001.jpg" /></h2>
and I set font size in calibre10 style to 0.5em

is img alt not supported in epub ?
?P<stuff> at just after an open parentheses lets you use names instead of \1 \2 or whatever syntax numeric backreferences use - I don't use them much as names are more readable and don't require counting parentheses.

<hopen> was a name I just made up, as was <title>. \g<groupname> is how you refer to the variables in the replacement expression.

As alt tags have no purpose on an ebook the search and replace just deleted the alt tag and moved it's contents into the title tag in the header. Sigil reads title tags when it creates a TOC, they have priority over any text that may be inside the <h2> tags (which is none in this case).

Last edited by ldolse; 03-02-2011 at 01:01 PM.
ldolse is offline   Reply With Quote