Nate Bargmann <n...@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