[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 03/05: Add pdf support for man UR/UE MT/ME
From: |
Deri James |
Subject: |
[groff] 03/05: Add pdf support for man UR/UE MT/ME |
Date: |
Tue, 12 Sep 2023 10:42:40 -0400 (EDT) |
deri pushed a commit to branch deri-gropdf-ng
in repository groff.
commit 766d4f280f501e8f01d64837f050bd3dfa2af900
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
AuthorDate: Wed Sep 6 22:35:23 2023 +0100
Add pdf support for man UR/UE MT/ME
G Branden request in bug #64576
---
tmac/an.tmac | 11 +++++++++++
tmac/pdf.tmac | 6 ++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 6c6ed6de1..d66294873 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -602,6 +602,7 @@ contains unsupported escape sequence
. PT
. ev
. ns
+. pdfmarkrestart
..
.
.\" Schedule a page break when the next output line is written (not
@@ -613,6 +614,7 @@ contains unsupported escape sequence
.\" Prepare the footer for a page of the document.
.de1 an-footer
. if \\n[an-suppress-header-and-footer] .return
+. pdfmarksuspend
. ev an*env-header-and-footer
. ie \\n[cR] \
. ds an*ofoot "\\*[an-pageref]\"
@@ -1084,6 +1086,7 @@ contains unsupported escape sequence
. if (\\n[an*is-in-link-text-diversion] & \\n[an*do-hyperlink]) \{\
. \" Start diversion in a new environment.
. ev an*link-text-env
+. if \\n[an*is-output-pdf] \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
. di an*link-text-div
. ll (\\n[an*saved-line-length]u - \\n[an*saved-indentation]u)
. \}
@@ -1107,6 +1110,9 @@ contains unsupported escape sequence
. ie \\n[dn] \{\
. if \\n[an*is-output-html] \
. nop \X^html:<a href="\\*[an*prefix]\\*[an*hyperlink]">^\c
+. if \\n[an*is-output-pdf] \{\
+. pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- "|"
+. \}
. if \\n[an*is-output-terminal] \
. nop \X^tty: link \\*[an*prefix]\\*[an*hyperlink]^\c
. \" Strip off the final newline of the diversion and emit it.
@@ -1117,6 +1123,8 @@ contains unsupported escape sequence
. nop \X^html:</a>^\c
. if \\n[an*is-output-terminal] \
. nop \X^tty: link^\c
+. if \\n[an*is-output-pdf] \
+. nop \X'pdf: markend'\m[\\*[pdf:curcol]]\c
. \}
. \" If there was no link text, format URI as its own link text. We
. \" don't add angle brackets here.
@@ -1124,6 +1132,9 @@ contains unsupported escape sequence
. if \\n[an*is-output-html] \
. nop \X^html:<a href="\\*[an*prefix]\\*[an*hyperlink]">\
\\*[an*hyperlink]</a>^\c
+. if \\n[an*is-output-pdf] \
+. pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- \
+\\*[an*hyperlink]
. if \\n[an*is-output-terminal] \
. nop \X^tty: link \\*[an*prefix]\\*[an*hyperlink]^\
\\*[an*hyperlink]\X^tty: link^\c
diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac
index 1c4c8866a..f300d612d 100644
--- a/tmac/pdf.tmac
+++ b/tmac/pdf.tmac
@@ -716,6 +716,7 @@ am solely responsible for any bugs I may have introduced
into this file.
.\" And now, we have no further use for "pdf*href.link".
.\"
.rm pdf*href.link
+.nr pdf:href.pipe 0
.\"
.\" If the user specified any "link prefix" text, (using the "-P text"
.\" option), then emit it BEFORE processing the "link text" itself.
@@ -751,9 +752,10 @@ am solely responsible for any bugs I may have introduced
into this file.
\#. if dPDFHREF.COLOUR .defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR]
. ds pdf:curcol \\n[.m]
. nr pdf:bm.width \\w'\\*[PDFHREF.DESC]'
+. if '\\*[PDFHREF.DESC]'|' .nr pdf:href.pipe 1
. nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
. device pdf: markstart \\n[rst] \\n[rsb] \\n[PDFHREF.LEADING]
\\*[pdf:href.link]
-. nop \&\\*[PDFHREF.DESC]\X'pdf: markend'\m[\\*[pdf:curcol]]\c
+. if !\\n[pdf:href.pipe] .nop \&\\*[PDFHREF.DESC]\X'pdf:
markend'\m[\\*[pdf:curcol]]\c
. \"
. \" Clean up the temporary registers and strings, used to
. \" compute the "hot-spot" bounds, and format the reference,
@@ -770,7 +772,7 @@ am solely responsible for any bugs I may have introduced
into this file.
.\" And then, if the user specified any affixed text, (using the
.\" "-A text" option), we tack it on at the end.
.\"
-.nop \&\\*[pdf:href-A]
+.if !\\n[pdf:href.pipe] .nop \&\\*[pdf:href-A]
..
.\" Macro "pdf*href-I" is used for one time initialisation of special
.\" "pdfhref" features; (currently, only the above page trap hook is
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 03/05: Add pdf support for man UR/UE MT/ME,
Deri James <=