Quote:
Originally Posted by lidao
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.