Quote:
Originally Posted by enuddleyarbl
How should I go about getting <i> and <em> tagged text to be recognizable (in my case, font-style: normal) in text that is styled with an italicized CSS?
BTW: it turns out that if I remove the & in those styles, EpubCheck is happy with it being gone, but then complains about the {} bracketing the font-style:normal stuff.
|
That's very poor coding. You should not use <i> or <em> to mean a normal font style.
create a class such as...
Code:
.normal {
font-style: normal;
}
Use the following regex (for a paragraph) to search (in the calibre editor). Replace italic with the name of the class you want.
Code:
(?s)(<p\b[^>]*class="[^"]*\bitalic\b[^"]*"[^>]*>(?:(?!</p>).)*?)<(i|em)\b[^>]*>(.*?)</\2>
Use the following regex search for a <div>. Also replace italic with your class name.
Code:
(?s)(<div\b[^>]*class=["'][^"']*\bitalic\b[^"']*["'][^>]*>(?:(?!</div>).)*?)<(i|em)\b[^>]*>(.*?)</\2>
This is the replace code for <p> or <div>.
Code:
\1<span class="normal">\3</span>