Quote:
Originally Posted by enuddleyarbl
If the <i> tags were only around small bits of text like ship names or foreign words, that's probably not a problem. I think I could use another class to override their italics to something like bold:
Code:
i i {
font-style: normal;
font-weight: bold;
}
|
One trick that I do when proofing something like this...
I add a temporary background-color:
Code:
i i {
background-color: red; <---- Add this line.
}
(This would highlight all <i> nested within other <i>s!)
As I skim through the preview of the ebook, the different colors stand out like a sore thumb. This lets me take a much closer look at the (problematic) areas.
When I'm done fixing up all the code, I remove the background-color.
- - -
Side Note: I sometimes use multiple colors for different things:
Just choose any of the
HTML Color Names if you want it easy.
You could then use something like:
Code:
background-color: green;
to let you know you already fixed it!
- - -
Quote:
Originally Posted by enuddleyarbl
[...] where there are clumps of text that should be treated as a syntactic whole (i.e., a quote at the top of a chapter, a poem, a letter, etc.), I'd like to apply a CSS class to handle the formatting. It's possible the styling embedded in the content will conflict with that present in the class.
|
Pretty good idea.
In that case, I mark with a
<div> or
<blockquote> plus a
class="".
For example:
Code:
<blockquote class="openingquote">
<p>Some amazing quote.</p>
<p class="right">—Tex</p>
</blockquote>
<div class="poem">
<div class="stanza">
<p class="line">The cow jumped over the moon.</p>
<p class="line">And Tex jumped over the <em>house</em>!</p>
</div>
</div>
Then you can easily toggle the italics on/off if needed:
What I tend to do is something along these lines:
Search: <i>(.+?)</i>
Replace: <span class="temppoem">\1</span>
and just go through the book on a case-by-case basis.
Combined with that background-color trick above, it makes it much easier to find these spots + fix them up.
- - -
After I'm done, I can then do a:
Search: <span class="temppoem">
and go mass replacing those new <span>s with whatever code I need.
(Usually use Diap's amazing Toolbag to shift to something clean!)
- - -
Quote:
Originally Posted by enuddleyarbl
But, if I included something like that where large swaths of text are italicized, all I'd end up with is large swaths of text bolded.
|
What does the original book look like?
Italics/Emphasis within italics = Roman (Straight up-and-down, normal text).
So let's say you were reading a Fiction book where all the character's inner thoughts are in italics:
Code:
<p><i class="thoughts">The ghost is going to <em>kill</em> my cat!</i>
Tex doused the door handle in holy water.
<i class="thoughts">Remind me to never read the <i class="booktitle">Necronomicon</i> or go aboard the <i class="shipname">HMS Haunty</i> ever again!</i></p>
These 4 words would all be Roman (= normal text):
- kill
- Necronomicon
- HMS Haunty
Similar to quotes within quotes, where you alternate:
- “Outer ‘Inner “Double-Inner” Inner’ Outer” (American)
- ‘Outer “Inner ‘Double-Inner’ Inner” Outer’ (British)
You do the same thing with italics!
Think of it like an ON/OFF switch:
- 1st layer = ON
- 2nd layer = OFF
- 3rd layer = ON
Then if you made all your thoughts be bold instead, you'd toggle the italics back on for those "inner" emphasis + book titles + ship names.
Quote:
Originally Posted by enuddleyarbl
Once I find the start of such a block, I can remove the intervening </i> and <i> pairs with "Replace and Find" and leave only the single starting and ending pair. I can probably work with that more easily.
|
One more trick I sometimes use:
Search: <i>([^<]{
100,})</i>
Replace: <span class="replace">\1</span>
Here's a breakdown of that Regex:
- <i> = "Look for an italics."
- (...) = "Stick all this stuff into Group 1."
- [^<] = "Look for any character that's NOT a less than sign."
- {100,} = "Look for 100 OR MORE of the previous thing."
- </i> = "Look for close of italics."
This will find really long italics, while ignoring any italics <100 characters long.
(Sometimes I start with high numbers, like 200, then progressively work my way down.)
Quote:
Originally Posted by enuddleyarbl
I'm assuming if there are consecutive entire paragraphs italicized, there's probably some kind of semantic block involved.
|
Yeah... every single ebook is going to be completely different.
We can give general principles/guidelines, but there definitely isn't a "one-button press" solution for complicated situations like this.
Like you might have another book with hundreds of different "calibre123" classes that all apply italics, and you'd have to figure out what each one does.
99.99% chance the ebooks aren't super clean with their <i> + <em> markup...
especially when dealing with nested cases like this!
- - -
Complete Side Note: If you want the ultimate info on Italics <i> and Emphasis <em>, see my posts in:
If you want even more examples of weird edge-cases like "quotes-within-quotes" or "should the punctuation be in italics?" see: