groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/15: [man]: Refactor (pdf:curcol).


From: G. Branden Robinson
Subject: [groff] 03/15: [man]: Refactor (pdf:curcol).
Date: Thu, 1 Feb 2024 23:45:26 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit b3e84477efb56c493d2f64eeb1f76d4417c9675f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Feb 1 20:43:21 2024 -0600

    [man]: Refactor (pdf:curcol).
    
    * tmac/an.tmac: Refactor.
    
      (an*begin-hyperlink): Before changing the stroke color to typeset the
      link text, save it in new string `an*saved-stroke-color` (as `MR`
      already does).
    
      (an*end-hyperlink): After setting hyperlinked text, restore the stroke
      color using the string we created for the purpose, not the mysterious
      internal "pdf.tmac" string `pdf:curcol`.  Delete string afterward.
---
 ChangeLog    | 11 +++++++++++
 tmac/an.tmac | 11 ++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f6345c7b5..49096d549 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-02-01  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/an.tmac: Refactor.
+       (an*begin-hyperlink): Before changing the stroke color to
+       typeset the link text, save it in new string
+       `an*saved-stroke-color` (as `MR` already does).
+       (an*end-hyperlink): After setting hyperlinked text, restore the
+       stroke color using the string we created for the purpose, not
+       the mysterious internal "pdf.tmac" string `pdf:curcol`.  Delete
+       string afterward.
+
 2024-02-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/an.tmac: Trivially refactor (an-write-paragraph-tag):
diff --git a/tmac/an.tmac b/tmac/an.tmac
index e7744b04c..c173c1764 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -1129,7 +1129,10 @@ 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' \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
+.    if '\*[.T]'pdf' \{\
+.      ds an*saved-stroke-color \\n[.m]\"
+.      nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
+.    \}
 .    di an*link-text
 .    ll (\\n[an*saved-line-length]u - \\n[an*saved-indentation]u)
 .  \}
@@ -1167,8 +1170,10 @@ 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[\\*[pdf:curcol]]\c
+.      if '\*[.T]'pdf' \{\
+.        nop \X'pdf: markend'\m[\\*[an*saved-stroke-color]]\c
+.        rm an*saved-stroke-color
+.      \}
 .    \}
 .    \" If there was no link text, format URI as its own link text.  We
 .    \" don't add angle brackets here.



reply via email to

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