Re: [PATCH] posix.py: ffix: Correctly format URIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux