groff-commit
[Top][All Lists]
Advanced

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

[groff] 05/05: doc/GMPfront.t: Support external man page xrefs.


From: G. Branden Robinson
Subject: [groff] 05/05: doc/GMPfront.t: Support external man page xrefs.
Date: Tue, 30 Jan 2024 23:25:21 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit df986e2480da79bad180b16e4b190aa09a4add5a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Jan 30 21:58:35 2024 -0600

    doc/GMPfront.t: Support external man page xrefs.
    
    * doc/GMPfront.t: Support non-internal man page cross references.  Port
      over contemporary implementation of `MR` from "an.tmac" to its local
      replacement in this file.  Also remove conditionals on the `.T` string
      matching "pdf".  Instead test this register once at the beginning of
      the file and skip it with the `nx` request if it doesn't match.  This
      lowers the complexity and average indentation level of the file.
    
    Fixes <https://savannah.gnu.org/bugs/?65231>.
---
 ChangeLog      | 12 ++++++++++++
 doc/GMPfront.t | 43 +++++++++++++++++++++++++++++++------------
 2 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a3f51f031..bb55e47bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-01-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * doc/GMPfront.t: Support non-internal man page cross
+       references.  Port over contemporary implementation of `MR` from
+       "an.tmac" to its local replacement in this file.  Also remove
+       conditionals on the `.T` string matching "pdf".  Instead test
+       this register once at the beginning of the file and skip it with
+       the `nx` request if it doesn't match.  This lowers the
+       complexity and average indentation level of the file.
+
+       Fixes <https://savannah.gnu.org/bugs/?65231>.
+
 2024-01-30  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * doc/GMPfront.t: Bikeshed the collected man pages.  Retitle to
diff --git a/doc/GMPfront.t b/doc/GMPfront.t
index 28a0a2954..ddbbea2d4 100644
--- a/doc/GMPfront.t
+++ b/doc/GMPfront.t
@@ -1,6 +1,9 @@
 .ig
        front.t
 ..
+.
+.if !'\*[.T]'pdf' .nx
+.
 .nr PDFOUTLINE.FOLDLEVEL 1
 .defcolor pdf:href.colour rgb 0.00 0.25 0.75
 .pdfinfo /Title "groff Collected Reference Pages"
@@ -21,25 +24,41 @@
 .
 .am reload-man END
 .de an*bookmark
-.  if '\\\\*[.T]'pdf' \{\
-.    ie (\\\\$1=1) \{\
-.       an*cln an*page-ref-nm \\\\$2\"
-.       pdfbookmark -T "\\\\*[an*page-ref-nm]" \\\\$1 \\\\$2
-.    \}
-.    el .pdfbookmark \\\\$1 \\\\$2
+.  ie (\\\\$1=1) \{\
+.     an*cln an*page-ref-nm \\\\$2\"
+.     pdfbookmark -T "\\\\*[an*page-ref-nm]" \\\\$1 \\\\$2
 .  \}
+.  el .pdfbookmark \\\\$1 \\\\$2
 ..
 .
 .de1 MR
 .  if ((\\\\n[.$] < 2) : (\\\\n[.$] > 3)) \
 .    an-style-warn .\\\\$0 expects 2 or 3 arguments, got \\\\n[.$]
-.  if '\\\\*[.T]'pdf' \{\
-.    ie \\\\n(.$=1 \
-.      I \\\\$1
+.  ds an*url man:\\\\$1(\\\\$2)\" used everywhere but macOS
+.  if (\\\\n[an*MR-URL-format] = 2) \
+.    ds an*url x-man-page://\\\\$2/\\\\$1\" macOS/Mac OS X since 10.3
+.  if (\\\\n[an*MR-URL-format] = 3) \
+.    ds an*url man:\\\\$1.\\\\$2\" Bwana (Mac OS X)
+.  if (\\\\n[an*MR-URL-format] = 4) \
+.    ds an*url x-man-doc://\\\\$2/\\\\$1\" ManOpen (Mac OS X pre-2005)
+.  nh
+.  ie \\\\n(.$=1 \{\
+.    ft \\\\*[MF]
+.    nop \\\\$1
+.    ft
+.  \}
+.  el \{\
+.    an*cln an*page-ref-nm \\\\$1(\\\\$2)
+.    ie d pdf:look(\\\\*[an*page-ref-nm]) \
+.      pdfhref L -D \\\\*[an*page-ref-nm] -A "\\\\$3" -- 
\f[\\\\*[MF]]\\\\$1\f[](\\\\$2)
 .    el \{\
-.      an*cln an*page-ref-nm \\\\$1(\\\\$2)
-.      ie d pdf:look(\\\\*[an*page-ref-nm]) .pdfhref L -D 
\\\\*[an*page-ref-nm] -A "\\\\$3" -- \fI\\\\$1\fP(\\\\$2)
-.      el .IR \\\\$1 (\\\\$2)\\\\$3
+.      ds an*saved-stroke-color \\\\n[.m]\"
+.      nop \&\m[\\\\*[PDFHREF.TEXT.COLOUR]]\c
+.      pdfhref W -D \\\\*[an*url] -- "|"
+.      nop \&\\\\*[an-lic]\f[\\\\*[MF]]\\\\$1\\\\*[an-ic]\f[R](\\\\$2)\c
+.      nop \X'pdf: markend'\m[\\\\*[an*saved-stroke-color]]\c
+.      rm an*saved-stroke-color
+.      nop \&\\\\$3
 .    \}
 .  \}
 .  hy \\\\n[an*hyphenation-mode]



reply via email to

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