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 08:53:17 +1100
User-agent: NeoMutt/20180716

Hi, Alex!

At 2022-02-07T19:58:33+0100, Alejandro Colomar (man-pages) wrote:
> Hi Branden,
> 
> I realized that when you break a hyperlink, the terminal shows an
> incorrect link.
> 
> For the following code:
> 
> [
> See:
> .UR
> https://www.kernel.org/\:doc/\:html/\:latest/\:process/\:coding-style.html\:#allocating-memory
> .UE
> ]
> 
> I see the following output:
> 
> [
>                      See:
>https://www.kernel.org/doc/html/latest/process/
>                      coding-style.html#allocating-memory⟩
> ]

The foregoing is not correct usage of the `UR` macro.  The `UR` macro
takes the URI as its _argument_, and then the link text (the visible
part) is what appears _between_ the `UR` and `UE` macros.

       .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.

We don't have a style warning for `UR` because it's over in the
extension macros which are supposed to maximally portable (even to
ancient troffs).

However, since with `MR` I've inaugurated a precedent of having multiple
implementations of the groff man(7) extension macros--the fancy one in
an.tmac and the backward-compatible ones in an-ext.tmac, maybe I should
go ahead and apply that same practice to `UR/UE` and `MT/ME`.  This was
on the horizon for PDF hypertext reference support anyway.

> When I try to open the link, I'm directed to
> <https://www.kernel.org/doc/html/latest/process/>, which may be a
> non-existing URI, or may be a wrong URI.
> 
> Tried with GNU groff version 1.23.0.rc1.1592-ae492.

Please check the corrected example in the attachment and see if it
behaves better for you.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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