View Single Post
Old 09-05-2023, 07:48 PM   #4
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Woodssi View Post
When reading, I absolutely hate punctuation marks that are italicised

When editing my books, is there a way to have Sigil search for
:-
<span class="italic"> any punctuation mark </span>
This is the regular expression I use:

Find: ([;’”,\)\]\.—])</span>
Replace: </span>\1

What it does is:
  • Find any of the punctuation listed inside the parentheses (before the </span>)
  • Shoves it OUTSIDE the </span>

So it would take something like this:

Code:
This is a <span class="italics">A Book Title.</span>
“What did you say to me you piece of <span class="italics">crap?”</span>
and converts it into:

Code:
This is a <span class="italics">A Book Title</span>.
“What did you say to me you piece of <span class="italics">crap</span>?”
You can also tweak it to whatever tags are needed, like one which will:

Find all Italics Ending Punctuation

Find: ([;’”,\)\]\.—])</i>
Replace: </i>\1

or:

Find all Italics Beginning Punctuation

Find: <i>([‘“\(—])
Replace: \1<i>

This will help correct things like:

Code:
<i>“Example Book</i> by First Last was the greatest book <em>ever!”</em>
by changing it to the correct:

Code:
“<i>Example Book</i> by First Last was the greatest book <em>ever</em>!”
- - -

Side Note: For more info, see my posts in:

If you need even more regex cleanup tips, see my posts in:

and if you need even more, type this into your favorite search engine:

Code:
Tex2002ans regex site:mobileread.com
Tex2002ans regular expression site:mobileread.com
I've given hundred of topics of examples, even lots with color-coded, step-by-step explanations.

Last edited by Tex2002ans; 09-05-2023 at 07:56 PM.
Tex2002ans is offline   Reply With Quote