linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: mtk.manpages@gmail.com,
	Alejandro Colomar <colomar.6.4.3@gmail.com>,
	linux-man@vger.kernel.org
Subject: Re: [PATCH] posix.py: ffix: Correctly format URIs
Date: Sun, 10 Jan 2021 17:50:25 +1100	[thread overview]
Message-ID: <20210110065023.olvhi2gqjbmv7243@localhost.localdomain> (raw)
In-Reply-To: <a1d2172c-3880-ac79-7df7-0f5fb0bc65af@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2635 bytes --]

Hi Alex,

I've noticed you've started formatting your emails like recommended
*roff input.  ;-)

I have, however, taken the liberty of reformatting them conventionally
for brevity.

At 2021-01-09T22:07:09+0100, Alejandro Colomar (man-pages) wrote:
> Hi Michael, Branden,
> On 1/9/21 8:58 PM, Alejandro Colomar wrote:
[...]
> > Enclose URIs in <>.  It is especially important in this case, as the
> > URIs are followed by '.'.  From "" or <>, I prefer <>, as they are
> > less used in other contexts, so they are more easily read as URIs.
[...]
> > Also enclose them in [.UR/.UE].
> 
> I was wondering if, instead of hardcoding <>, it would be possible to
> make .UR/.UE embed those characters.  It would make the code more
> generic, but I don't know if it is feasible or desirable.

Not only is it possible, but the groff_man(7) .UR/.UE extension macros
have been doing this automatically since they were introduced in January
2007.

They use left and right angle bracket special character escapes (Unicode
U+2039 and U+203A)[1]; the output drivers degrade these to less-than and
greater-than signs if the former glyphs are unavailable, or if the
formatter is not groff[2].

Here are some of the relevant portions of tmac/an-ext.tmac.

[...]
  .\" groff has glyph entities for angle brackets.
  .ie \n(.g \{\
  .  ds la \(la\"
  .  ds ra \(ra\"
  .\}
  .el \{\
  .  ds la <\"
  .  ds ra >\"
  .  \" groff's man macros control hyphenation with this register.
  .  nr HY 1
  .\}
[...]
  .\" End URL.
  .de UE
[...]
  .    nh
  \\*(la\\*(m1\\*(ra\c
  .    ie \n(.g \&\\$*\"
  .    el \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9\"
  .    hy \\n(HY
[...]
  ..

The macro has a lot of conditional logic to support multiple formatters,
include non-groff ones--it attempts to be usable even with old AT&T
troff.  For the same reason, the register and string names used are
short and unfriendly.  It also does special things when formatting for
groff's HTML output device, which I do not show above.  But the heart of
the matter for terminal output is the line

  \\*(la\\*(m1\\*(ra\c

which uses the left and right angle bracket strings defined previously.

Let me know if you could use the above in annotated form.

If something in your test environment is preventing the angle brackets
from being rendered, maybe I could help you troubleshoot it?

Regards,
Branden

[1] https://man7.org/linux/man-pages/man7/groff_char.7.html#Glyph_tables
[2] Technically, if the formatter does not claim groff compatibility by
    setting the .g register to a positive value.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-01-10  6:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09 19:58 [PATCH] posix.py: ffix: Correctly format URIs Alejandro Colomar
2021-01-09 21:07 ` Alejandro Colomar (man-pages)
2021-01-10  6:50   ` G. Branden Robinson [this message]
2021-01-10 14:35     ` Alejandro Colomar (man-pages)
2021-01-10 14:57       ` [PATCH v2] " Alejandro Colomar
2021-01-19 19:59         ` Ping: " Alejandro Colomar (man-pages)
2021-01-20  8:50         ` Michael Kerrisk (man-pages)
2021-01-20  8:55         ` Michael Kerrisk (man-pages)
2021-01-12 20:51       ` [PATCH] " Jakub Wilk
2021-01-14  7:11         ` G. Branden Robinson
2021-01-21 19:54         ` Alejandro Colomar (man-pages)
2021-01-21 20:14           ` Jakub Wilk
2021-01-21 20:19             ` Alejandro Colomar
2021-01-22  3:23             ` G. Branden Robinson
2021-01-22  9:35               ` Jakub Wilk
2021-01-22 10:07                 ` G. Branden Robinson
2021-01-22 10:50                   ` Alejandro Colomar (man-pages)
2021-01-22 14:51                     ` G. Branden Robinson
2021-01-22 17:27                       ` Alejandro Colomar (man-pages)
2021-01-09 22:09 ` Alejandro Colomar (man-pages)
2021-01-22 12:37 ` Ping: " Alejandro Colomar (man-pages)
2021-01-22 15:13   ` Michael Kerrisk (man-pages)
2021-01-22 18:19     ` Alejandro Colomar (man-pages)
2021-01-23  9:15       ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210110065023.olvhi2gqjbmv7243@localhost.localdomain \
    --to=g.branden.robinson@gmail.com \
    --cc=alx.manpages@gmail.com \
    --cc=colomar.6.4.3@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).