View Single Post
Old 10-17-2021, 01:15 PM   #6
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 mjcatt View Post
In written spanish dialog, em dash is used somewhat like quotes in english and there are some times where it is followed by a period, for example: —. or possibly —,

[...]

Also, as far as I can tell, there is no accepted HTML/CSS code (except possibly for one inconvenient depreciated <nobr> tag), but I'm no expert.

Does anyone know of a way the keep these punctuation characters together?
You may want to try this:

1. Using the "Word Joiner" Character

Open up your EPUB, and:

Search: —.
Replace: —&#8288;.

Search: —,
Replace: —&#8288;,

That should "combine" the dash + period/comma into a single chunk, telling Moon+ not to line-break there.

2. If that doesn't work, then maybe a CSS solution.

(Although Moon+ is one of the bad readers that throws away all "publisher CSS". I recommend using a more standards-compliant reader.)

We discussed lots of different methods in 2019: "No break space and alignment".

This one is extremely hackish, so it's not recommended:

HTML:

Code:
<p>—Se habrá perdido —respondió <span class="nobreak">Billy—.</span> Vamos.</p>
CSS:

Code:
.nobreak {
  white-space: pre;
}
In English, that CSS tries to say:

"Hey, I already pre-did the linebreaks+spacing here for you. Keep Billy + EM DASH + PERIOD all together. Don't you mess with it!"

You may be able to more easily apply this to your book by using this regex:

Search: (\w+)—([,\.])
Replace: <span class="nobreak">\1—\2</span>

which looks for:

1. Any letters
2. EM DASH
3. comma OR period

then wraps the <span> around it.

But again, I don't recommend mangling up all your code for this. Instead, use a much better reader that actually follows the standards. (PocketBook is a very good reader on Android.)

Last edited by Tex2002ans; 10-17-2021 at 01:20 PM.
Tex2002ans is offline   Reply With Quote