groff
[Top][All Lists]
Advanced

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

Re: Groff macro to make .UR and .UE links clickable in PDF?


From: B 9
Subject: Re: Groff macro to make .UR and .UE links clickable in PDF?
Date: Sun, 21 Jun 2020 22:56:06 -0700
User-agent: s-nail v14.9.11

Nate Bargmann <n0nb@n0nb.us> wrote:

> I concur with Deri as the link is not clickable in evince on Debian
> Linux in this PDF.

Oh, thank goodness. So, I'm not the only one. So, I guess that brings
me back to my original question: Can groff make links clickable when
rendering to PDF? And, I guess the answer is, No, not at the moment.

To summarize just a few of the answers I received (so far):

  John Gardner: Groff ought to leverage PDF features with man(7), mdoc(7).
                Why doesn't it?

  James Lowden: If someone can write macro magic to make hyperlinks 
                Just Work in man, mdoc, ms, James will edit the man pages.

  Deri James: Here's a perl preprocessor, pdfman, that transforms man
              hypertext references (.Xr, .Sx, .UR, ...) and targets
              (.Sh, .Ss, .Tp, ...) into pdfmark code.

  Steve Izma: Here are some strategies for typesetting URLs.


Deri's answer does seem to do the job for my document, but it is
written in Perl and its regex parsing is a bit fragile. Also the groff
code it outputs only works on PDF. It would be nice if it could output
conditional code so the pdfmark commands are only used when rendering
to PDF, perhaps using the code John Gardner suggested:

    .if '\*(.T'pdf' .if d pdfmark \{\
    .    pdfmark ...
    .\}


I've been attempting to write a groff macro to do something similar
just for .UR/.UE or .Lk links, but I only recently started learning
groff. So far, no luck. But, I did discover that there is actually a
third type of link I was overlooking: -mwww provides .URL which has
the nice property of wrapping URLs using some heuristic. Also, unlike
.Lk, it can handle trailing punctuation.

--b9




reply via email to

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