View Single Post
Old 12-21-2020, 10:07 PM   #27
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 AlanHK View Post
That will work for most cases. But not if a speech goes over several paragraphs. Then only the final para has a close quote.
In that case the <b> codes will overlap the <p> and you'll have a syntax error.
If there isn't a < or a closing quote, mine won't match.

So if you had an extended speech, my Regex would see:
  • a single opening quote
  • keep going until it hits the < in </p>
  • and jump out, failing to match since there's no ”

As noted, mine also wouldn't work with any sort of formatting inside the quotes (<i>, <b>, <span>, etc.). It's just a very dumb, very quick, Regex... not meant to cover every case in the book, just the vast majority of "easy" cases.

Mine also wouldn't introduce any syntax errors... where a mass replace like you're suggesting has a high probability.

(ESPECIALLY since wrong/mismatched quotations are where a huge minority of typos are introduced, even in fully proofed/published books. [See discussion on Toxaris's EPUB Tools > Dialogue Check.])

Quote:
Originally Posted by AlanHK View Post
That will also screw up with extended speech, but simpler to fix as you just have to add closing </b> to intermediates paras.
I don't think so.

Let's say mine covers 95% of the normal cases, and misses the 5% extended speeches. But it replaces it in a single stroke.

Yours might cover "100%" of the cases, but then you have to spend time manually correcting 5%.
Tex2002ans is offline   Reply With Quote