View Single Post
Old 12-02-2020, 09:32 PM   #3
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,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by lidao View Post
so when characters in the novel are talking: "insert talking here" it shows as "insert talking here"
I'm very interested to hear why you're doing this. I've been toying around with a similar concept for a few years, although I've been highlighting pieces of sentences different colors.

This is a very rough Regex to do what you want:

Search: (“[^”<]+”)
Replace: <b>\1</b>

which turns this:

Code:
<p>This is a “test and a test” and some “more.”</p>
<p>“Wow,” Alice said, “that works!”</p>
into this:

Code:
<p>This is a <b>“test and a test”</b> and some <b>“more.”</b></p>
<p><b>“Wow,”</b> Alice said, <b>“that works!”</b></p>
Note: This requires proper Smart (“Curly”) Quotes.

If your book has "Dumb Quotes", you have to run it through a punctuation smartener first.

In Calibre, it can be found under Convert Books > Convert Individually > Look & Feel > Text > Smarten punctuation.

In Sigil, you could use DiapDealer's fantastic plugin, "PunctuationSmarten".

Alternate #1: Instead of using <b> for bold, you could always use a normal span:

Search: (“[^”<]+”)
Replace: <span class="dialogue">\1</span>

with this CSS:

Code:
span.dialogue {
	font-weight: bold;
}
Alternate #2: Or, if you're working in EPUB3, you can use HTML5's <mark> to highlight words:

Search: (“[^”<]+”)
Replace: <mark class="dialogue">\1</mark>

You can change the highlighted color (default yellow) with this CSS:

Code:
mark.dialogue {
	background-color: orange;
}
Note #2: All those searches are based on clean and basic text. If there's any sort of brackets in the middle (like italics <i>), it won't work.

Last edited by Tex2002ans; 12-02-2020 at 09:35 PM.
Tex2002ans is offline   Reply With Quote