Topics

[Fwd: Re: [Clip] Adding an HTML space after a period (.)]


Axel Berger
 

Resent, hasn't arrived after man hours:

-------- Original Message --------
Subject: Re: [Clip] Adding an HTML space after a period (.)
Date: Sat, 15 Aug 2020 17:50:48 +0200
From: Axel Berger <Axel@...>
To: ntb-clips-owner@...
References: <0bfe3531-ce7a-6300-f23d-ef1ae34de21c@...>

"Mike Breiding - Morgantown WV epicroadtrips@... [ntb-clips]" wrote:
Any ideas
First off this is bound to be one of those things that can't be made
fool-proof. Many of my clips end with a (typically quite complex) ^!Find
and I then <F3> through the file to inspect all those suspect places. With
the frequency of full stops this is bound to be somewhat time consuming.

Second "replace all with the exception of" is something I typically do as a
two step process. I first do everything and then repair the mistakes. This
is usually easier than writing a precise and comprehensive rule.

In step one you only look at periods followed by capital letters followed
by at least one more letter. That alone eliminates many exceptions. A
period followed by a single capaital is usually part of an abbreviation,
but note that in English "I" is a full fledged noun, we don't have one as
short in German.

In a second step repair all links. This is something I do often, so I
copied and adapted this from an existing clip:

^!Replace "(https?://[^ \r\n]+)(\. )" >> "$1." WRAST
^!IfError NEXT ELSE SKIP_-1

BTW I used a simple space above. A non breaking one between sentences
sounds strange, but you may have your reasons. Or do you want the American
convention of a double space between sentences? If so this would place look
over content and be against the idea of HTML.


--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --


WV- Mike
 

On 8/15/2020 3:59 PM, Axel Berger wrote:
I first do everything and then repair the mistakes.
This is the story of my life in a nutshell.

By now I imagine you have read my reply to Marcelo as to what I was trying to achieve and his S&R suggestion on how to do it.

Thanks,
WV-Mike

-- Mike Breiding www.EpicRoadTrips.us


Axel Berger
 

WV- Mike wrote:
By now I imagine you have read my reply to Marcelo as to what I was
trying to achieve and his S&R suggestion on how to do it.
Yes, it was my guess in the last sentence. I stand by what I said. This is
not content, it should be done through CSS or not at all. As I can't find
any CSS way to achieve it, it's the latter. Making text look good is the
job of the browser. If browsers do it badly that's regrettable but meddling
with content tends to make things worse.


--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --


loro
 

At 12:40 PM 2020-08-16 +0200, Axel Berger wrote:
WV- Mike wrote:
By now I imagine you have read my reply to Marcelo as to what I was
trying to achieve and his S&R suggestion on how to do it.
Yes, it was my guess in the last sentence. I stand by what I said. This
is
not content, it should be done through CSS or not at all. As I can't
find
any CSS way to achieve it, it's the latter. Making text look good is the
job of the browser. If browsers do it badly that's regrettable but
meddling
with content tends to make things worse.
Wouldn't &ensp; or &emsp; suffice? Personally I think em space is too large, but en space looks fairly good. It's clutter, but a tad better than &nbsp;.
Here are more spaces.
http://jkorpela.fi/chars/spaces.html

Would be nice with a ::sentence pseudo element. Guess problem is to define a sentence. Not everything beginning on a capital letter and ending with period is.

Lotta


Marcelo Bastos
 

On 15/08/2020 16:59, Axel Berger wrote:

BTW I used a simple space above. A non breaking one between sentences
sounds strange, but you may have your reasons. Or do you want the American
convention of a double space between sentences? If so this would place look
over content and be against the idea of HTML.
I _kinda-sorta_ agree on the concept -- double spaces between sentences
ARE a stylistic convention, that is, presentational, and shouldn't in an
ideal world be handled at the HTML level. Unfortunately, there is no
convenient way to do it in CSS since there's no convenient definition of
"sentence" in terms of HTML and CSS. The best I could do, I suppose,
would be to place every sentence inside its own HTML element (possibly a
<span class="sentence">) and then attempt to use CSS. I say "attempt"
because I haven't tested different browsers to check what would be the
result of fiddling with the margin and/or padding of inline elements.
Which is to say, I would be adding a lot of bloat to the code with a
nontrivial likelihood of introducing rendering weirdness. If you HAVE to
have double spaces, you are probably better off resorting to the &nbsp;
hack.

Fortunately, that's not really an issue for me because I don't subscribe
to that somewhat quaint convention. Two spaces after sentences might
have made sense in typewriters, but they aren't particularly helpful in
increasing readability in well-rendered, proportional fonts.

Loro mentioned using &ensp; or &emsp; instead of regular spaces. It
might work, although at least one source claims that browser support for
different-width spaces is not universal (apparently Firefox renders all
of them with the same width, or at least did so at one time). Also,
since those are rather uncommonly-used character entities, you can't
rule out causing issues in other types of user-agents (such as, say,
screen readers). And, at the end of the day... that's still hacking the
content to achieve a presentational effect.

--
MCBastos

This message has been protected with the 2ROT13 algorithm. Unauthorized use will be prosecuted under the DMCA.


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


loro
 

Marcelo Bastos wrote:
Loro mentioned using &ensp; or &emsp; instead of regular spaces. It
might work, although at least one source claims that browser support for
different-width spaces is not universal (apparently Firefox renders all
of them with the same width, or at least did so at one time).
The latter, did so but doesn't anymore.

Also,
since those are rather uncommonly-used character entities, you can't
rule out causing issues in other types of user-agents (such as, say,
screen readers). And, at the end of the day... that's still hacking the
content to achieve a presentational effect.
I don't think so.

But I'm generally with Axel. I wouldn't do this at all. But if you don't mind clutter, you could as well wrap all periods in a span and set their right margin to whatever you want.

I've also seen a JS solution. I think it involved jQuery or something similar. I wouldn't do that either, but it's out there somewhere.

Lotta


WV- Mike
 

On 8/16/2020 10:26 AM, loro wrote:
But if you don't mind clutter, you could as well wrap all periods in a span and set their right margin to whatever you want.
Talk about clutter!  ;)
I will take a single &ensp; over a span  for every period anytime.
As you can tell I am not a purist and I consider these types of "hacks" insignificant.

WV-Mike

-- Mike Breiding www.EpicRoadTrips.us


WV- Mike
 

On 8/16/2020 8:33 AM, loro wrote:
Wouldn't &ensp; or &emsp; suffice? Personally I think em space is too large, but en space looks fairly good. It's clutter, but a tad better than &nbsp;. Here are more spaces. http://jkorpela.fi/chars/spaces.html Would be nice with a ::sentence pseudo element. Guess problem is to define a sentence. Not everything beginning on a capital letter and ending with period is. Lotta
I am not one to think outside of the box so I never thought of using anything but nb space and did not know about &ensp; or &emsp;.
I agree em space is too large.

Some examples of various combinations:
https://EpicRoadTrips.us/2020/sentence_space/ <https://epicroadtrips.us/2020/sentence_space/>

Thanks,
WV-Mike

-- Mike Breiding www.EpicRoadTrips.us