[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/01: [man]: Back away from color management concerns.
From: |
G. Branden Robinson |
Subject: |
[groff] 01/01: [man]: Back away from color management concerns. |
Date: |
Fri, 2 Feb 2024 03:42:33 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 52a5a89c0da9f90c83441b8eb8020344a8468686
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Feb 1 23:23:45 2024 -0600
[man]: Back away from color management concerns.
Hyperlink colors in PDF were showing a tendency to get "stuck on" when
they shouldn't, and the extra difficulty of managing nested traps (`TP`
followed by `UR`, for example) is proving tricky to sort out. On top of
that, the man(7) package historically has no cognizance of color issues
and it's doesn't seem like a good time to start, particularly if we only
do it for the 'pdf' output device. Unfortunately, "pdf.tmac" doesn't
expose a clean abstraction for "link starts here" and "link stops here",
instead implementing a hugely featured `pdfhref` macro that attempts to
do everything--except support bracketing the link text in a diversion,
which our man(7) design requires.
* tmac/an.tmac (an-input-trap): Set stroke color to default after
springing `TP`'s supporting trap.
(an*begin-hyperlink, MR): Stop saving the stroke color.
(an*end-hyperlink, MR): Stop restoring the saved stroke color. Set it
to the default instead after formatting the link text.
---
ChangeLog | 22 ++++++++++++++++++++++
tmac/an.tmac | 19 +++++++------------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0dc65ba62..d103fd649 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2024-02-02 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [man]: Back away from color management concerns.
+
+ Hyperlink colors in PDF were showing a tendency to get "stuck
+ on" when they shouldn't, and the extra difficulty of managing
+ nested traps (`TP` followed by `UR`, for example) is proving
+ tricky to sort out. On top of that, the man(7) package
+ historically has no cognizance of color issues and it's doesn't
+ seem like a good time to start, particularly if we only do it
+ for the 'pdf' output device. Unfortunately, "pdf.tmac" doesn't
+ expose a clean abstraction for "link starts here" and "link
+ stops here", instead implementing a hugely featured `pdfhref`
+ macro that attempts to do everything--except support bracketing
+ the link text in a diversion, which our man(7) design requires.
+
+ * tmac/an.tmac (an-input-trap): Set stroke color to default
+ after springing `TP`'s supporting trap.
+ (an*begin-hyperlink, MR): Stop saving the stroke color.
+ (an*end-hyperlink, MR): Stop restoring the saved stroke color.
+ Set it to the default instead after formatting the link text.
+
2024-02-01 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Fix Savannah #61434.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 04873aebf..1e48b3c95 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -685,7 +685,10 @@ contains unsupported escape sequence
. \" .TP
. \" .B foo
. \" for instance.
-. if '\\n[.z]'an*paragraph-tag' .an*TP-trap
+. if '\\n[.z]'an*paragraph-tag' \{\
+. an*TP-trap
+. gcolor \m[default]
+. \}
..
.
.\" The TP macro _requires_ a one-line input trap.
@@ -1135,10 +1138,7 @@ contains unsupported escape sequence
. \" Start diversion in a new environment.
. nr an*is-in-link-text-diversion 1
. ev an*link-text-env
-. if '\*[.T]'pdf' \{\
-. ds an*saved-stroke-color \\n[.m]\"
-. nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
-. \}
+. if '\*[.T]'pdf' \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
. di an*link-text
. ll (\\n[an*saved-line-length]u - \\n[an*saved-indentation]u)
. \}
@@ -1176,10 +1176,7 @@ contains unsupported escape sequence
. nop \X'html:</a>'\c
. if \\n[an*is-output-terminal] \
. nop \X'tty: link'\c
-. if '\*[.T]'pdf' \{\
-. nop \X'pdf: markend'\m[\\*[an*saved-stroke-color]]\c
-. rm an*saved-stroke-color
-. \}
+. if '\*[.T]'pdf' \X'pdf: markend'\m[default]\c
. \}
. \" If there was no link text, format URI as its own link text. We
. \" don't add angle brackets here.
@@ -1281,7 +1278,6 @@ contains unsupported escape sequence
. if '\*[.T]'html' \
. nop \X'html:<a href="\\*[an*url]">'\c
. if '\*[.T]'pdf' \{\
-. ds an*saved-stroke-color \\n[.m]\"
. nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
. pdfhref W -D \\*[an*url] -- "|"
. \}
@@ -1293,8 +1289,7 @@ contains unsupported escape sequence
. if '\*[.T]'html' \
. nop \X'html:</a>'\c
. if '\*[.T]'pdf' \{\
-. nop \X'pdf: markend'\m[\\*[an*saved-stroke-color]]\c
-. rm an*saved-stroke-color
+. nop \X'pdf: markend'\m[default]\c
. \}
. if \\n[an*is-output-terminal] \
. nop \X'tty: link'\c
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/01: [man]: Back away from color management concerns.,
G. Branden Robinson <=