groff
[Top][All Lists]
Advanced

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

Re: [BUG] Hyperlink macros: breaking should conserve the full hyperlink


From: G. Branden Robinson
Subject: Re: [BUG] Hyperlink macros: breaking should conserve the full hyperlink
Date: Tue, 8 Feb 2022 09:57:49 +1100
User-agent: NeoMutt/20180716

Hi Alex,

At 2022-02-07T23:12:59+0100, Alejandro Colomar (man-pages) wrote:
> Hmmmm, groff_man(7) isn't explicit in the need for a link text for
> .UR/.UE or .MT/.ME.

Right.

> Is it really needed?

No.

> What if the link text should be exactly the URI?  Why repeat it?

Repeat how?  In the input or the output?  In the input that is
unnecessary, and in the output that should be impossible.

> >        .UR uri
> >        .UE [trailing-text]
> >               Identify uri as an RFC 3986 URI hyperlink with the text
> >               between the two macro calls as the link text.  An argument
> >               to .UE is placed at the end of the link text without
> >               intervening space.  uri may not be visible in the rendered
> >               document if the output driver supports hyperlinks.  If it
> >               does not, uri is set in angle brackets after the link text
> >               and before trailing-text.
> > 
> >> And XFCE terminal highlights as a hyperlink _only_ the part that is on
> >> the first line (i.e., up to 'process/').  The second part (i.e.,
> >> 'coding'...) isn't highlighted, and most importantly, isnt' part of the
> >> hyperlink.
> > 
> > You might say that `UR` is "generous in what it accepts".  If it has no
> > argument, it attempts to create a hyperlink out of the link text.  It
> > doesn't do a very good job.
> 
> It's actually the other way around, I think.  I provided the URI
> (hyperlink), and I omitted the link text.  It shouldn't fail to create a
> hyperlink, since the URI, which I provided, is sufficient and necessary
> to create a hyperlink.

This:

.UR
http://foo.bar/baz
.UE

...is, to groff man(7), a `UR` with _no_ uri argument and a URL as the
link text.

Using a URL/URI as the link text has the potential for great confusion.

.UR http://real.destination.fsb.gov.ru/
https://red-cross.ua/care-packages-for-soldiers/
.UE

Here are examples of UR/UE usage from groff's own man page corpus.

contrib/gpinyin/gpinyin.1.man:.UR http://\:www\:.pinyin\:.info/\:index\:.html
contrib/gpinyin/gpinyin.1.man-.I Pinyin.info: a guide to the writing of 
Mandarin Chinese in \
contrib/gpinyin/gpinyin.1.man-romanization
contrib/gpinyin/gpinyin.1.man-.UE ,

contrib/mm/groff_mm.7.man:.UR 
https://tkurtbond\:.github\:.io/\:troff/\:mm-all\:.pdf
contrib/mm/groff_mm.7.man-.I MM \- A Macro Package for Generating Documents
contrib/mm/groff_mm.7.man-.UE ,

contrib/mom/groff_mom.7.man:.UR 
http://\:www\:.schaffter\:.ca/\:mom/\:momdoc/\:toc\:.html
contrib/mom/groff_mom.7.man-.UE

contrib/pic2graph/pic2graph.1.man:.UR 
http://\:www\:.kohala\:.com/\:start/\:troff/\:pic2html\:.html
contrib/pic2graph/pic2graph.1.man-.I Turning PIC into HTML
contrib/pic2graph/pic2graph.1.man-.UE

man/roff.7.man:.UR 
http://\:web\:.mit\:.edu/\:Saltzer/\:www/\:publications/\:ctss/\:AH\
man/roff.7.man-\:.9\:.01\:.html
man/roff.7.man-.I RUNOFF
man/roff.7.man-manual of December 1966
man/roff.7.man-.UE

They seem to cover a few bases.

If we can find some cases where groff is emitting hyperlinks that it
shouldn't, I'm keen to fix those, but we don't have any power to keep a
terminal emulator from opportunistically hyperlinking text that _looks_
like a URL to it.  To verify this, you can check the device-independent
output of troff(1) by giving groff(1) the -Z option.  You will get plain
text output that may look bewildering at first; it is documented in
groff_out(5).  For our immediate purposes, just grep it or visually scan
for lines like this:

x X tty: link http://www.multicians.org/
x X tty: link

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]