groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/14: tmac/an.tmac: Trivially refactor (is-output-pdf).


From: G. Branden Robinson
Subject: [groff] 04/14: tmac/an.tmac: Trivially refactor (is-output-pdf).
Date: Sun, 28 Jan 2024 19:55:01 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 6f12a82806236371fe27c9a30a29e7d6976c3bc0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Jan 27 16:25:19 2024 -0600

    tmac/an.tmac: Trivially refactor (is-output-pdf).
    
    * tmac/an.tmac: Trivially refactor.
      (an*bookmark, an*header, an*footer, an*begin-hyperlink)
      (an*end-hyperlink, (initialization)): Retire `an*is-output-pdf`
      register (and interpolation-time checks of its value) in favor of
      (load-time) use of output comparison operator to check built-in `.T`
      string against value "pdf".
---
 ChangeLog    |  9 +++++++++
 tmac/an.tmac | 22 +++++++++++-----------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bfe4d0b6e..2df773e32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-01-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/an.tmac: Trivially refactor.
+       (an*bookmark, an*header, an*footer, an*begin-hyperlink)
+       (an*end-hyperlink, (initialization)): Retire `an*is-output-pdf`
+       register (and interpolation-time checks of its value) in favor
+       of (load-time) use of output comparison operator to check
+       built-in `.T` string against value "pdf".
+
 2024-01-26  Deri James  <deri@chuzzlewit.myzen.co.uk>
 
        Our documentation groff_man.7 documents that these requests are
diff --git a/tmac/an.tmac b/tmac/an.tmac
index cfedbe28b..23234db94 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -207,7 +207,7 @@
 .
 .\" Write a bookmark/anchor/link target $2 at hierarchical depth $1.
 .de an*bookmark
-.  if \\n[an*is-output-pdf] .pdfbookmark \\$1 \\$2
+.  if '\*[.T]'pdf' .pdfbookmark \\$1 \\$2
 ..
 .
 .\" Begin man page.
@@ -587,7 +587,7 @@ contains unsupported escape sequence
 .  PT
 .  ev
 .  ns
-.  if '\\*[.T]'pdf' .pdfmarkrestart
+.  if '\*[.T]'pdf' .pdfmarkrestart
 ..
 .
 .\" Schedule a page break when the next output line is written (not
@@ -599,7 +599,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
-.  if '\\*[.T]'pdf' .pdfmarksuspend
+.  if '\*[.T]'pdf' .pdfmarksuspend
 .  ev an*env-header-and-footer
 .  ie \\n[cR] \
 .    ds an*ofoot "\\*[an-pageref]\"
@@ -1108,7 +1108,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
+.    if '\*[.T]'pdf' [\\*[PDFHREF.TEXT.COLOUR]]\c
 .    di an*link-text-div
 .    ll (\\n[an*saved-line-length]u - \\n[an*saved-indentation]u)
 .  \}
@@ -1132,7 +1132,7 @@ 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] \{\
+.      if '\*[.T]'pdf' \{\
 .        pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- "|"
 .      \}
 .      if \\n[an*is-output-terminal] \
@@ -1145,7 +1145,7 @@ 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] \
+.      if '\*[.T]'pdf' \
 .        nop \X'pdf: markend'\m[\\*[pdf:curcol]]\c
 .    \}
 .    \" If there was no link text, format URI as its own link text.  We
@@ -1154,7 +1154,7 @@ 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] \
+.      if '\*[.T]'pdf' \
 .        pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- \
 \\*[an*hyperlink]\c
 .      if \\n[an*is-output-terminal] \
@@ -1331,8 +1331,6 @@ contains unsupported escape sequence
 .
 .nr an*is-output-html 0
 .if '\*[.T]'html' .nr an*is-output-html 1
-.nr an*is-output-pdf 0
-.if '\*[.T]'pdf' .nr an*is-output-pdf 1
 .nr an*is-output-terminal 0
 .if '\*(.T'ascii'  .nr an*is-output-terminal 1
 .if '\*(.T'cp1047' .nr an*is-output-terminal 1
@@ -1341,10 +1339,12 @@ contains unsupported escape sequence
 .
 .nr an*can-hyperlink 0
 .if (  \n[an*is-output-html] \
-     : \n[an*is-output-pdf] \
      : \n[an*is-output-terminal]) \
 .  nr an*can-hyperlink 1
 .
+.if '\*[.T]'pdf' \
+.  nr an*can-hyperlink 1
+.
 .ds an*body-family \n[.fam]
 .ds an*example-family C \" Courier
 .
@@ -1369,7 +1369,7 @@ contains unsupported escape sequence
 .\" Set each rendering parameter only if its -[dr] option or man.local
 .\" did not.
 .
-.if \n[an*is-output-pdf] \{\
+.if '\*[.T]'pdf' \{\
 .  \" FIXME: The following registers are documented only in pdf.tmac.
 .  if !r PDFOUTLINE.FOLDLEVEL .nr PDFOUTLINE.FOLDLEVEL 1
 .  if !r PDFHREF.VIEW.LEADING .nr PDFHREF.VIEW.LEADING 10p



reply via email to

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