[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hypertext solution
From: |
B 9 |
Subject: |
Hypertext solution |
Date: |
Wed, 01 Jul 2020 00:11:16 -0700 |
User-agent: |
s-nail v14.9.11 |
As you all know, I've been looking for an easy way to specify a hypertext link
that would be visible in nroff and clickable in PDF. It turned out there was no
solution within groff.... Until now. :-)
I've attached my modified www.tmac which you can drop into /etc/groff. The .URL
macro will now create links for a PDF. This is how it already worked for HTML,
and it wasn't too hard to use the nifty pdfmark.tmac package to extend it.
Usage: .URL <URI> [descriptive-text [affix-text [prefix-text]]]
I also added a new .LINK macro which is similar but hides the URI on devices
that don't support hypertext.
Also attached, please see a sample document I created (ywww.6) to exercise the
new features and check for regressions in www.tmac. I believe I made only two
visible changes. First, the link text in pdfs is a little bit darker blue so it
is not as distracting when reading. Second, for output devices that do not
support color, the link is marked using underline (nroff), italics (b&w
postscript), or a light grey dashed box (b&w pdf).
My hope is that the modifications I've made to www.tmac can be included in the
next release of groff.
Please try it and let me know what you think.
--b9
P.S. Maybe todo items:
1. One of the nice things about extending the www.tmac package is
that it already has some intelligence about wrapping long URLs
at slashes. It could use more, though. It still sticks in
hyphens instead of wrapping at %, ?, _, etc. But, the code it
uses to do wrapping was a bit too complex for a groff novice
like me to be mucking with. Anyone else feel like improving
www.tmac to meet Steve Izma's recommendations?
2. Allow users to add anchors for internal document hyperlinks
from within www.tmac.
3. Rewrite mandoc's .Xr, .Sx, .Sh, .Ss, .Tp, so that pdfmark is
used when generating PDF out. (Like Deri's pdfman perl script).
www.tmac
Description: Text Data
ywww.6
Description: Text Data
ywww.pdf
Description: Adobe PDF document
- Hypertext solution,
B 9 <=