View Single Post
Old Yesterday, 04:25 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 85,615
Karma: 154365185
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by enuddleyarbl View Post
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>

Last edited by JSWolf; Yesterday at 04:40 PM.
JSWolf is offline   Reply With Quote