groff-commit
[Top][All Lists]
Advanced

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

[groff] 07/14: [man]: Trivially refactor.


From: G. Branden Robinson
Subject: [groff] 07/14: [man]: Trivially refactor.
Date: Thu, 22 Feb 2024 17:49:15 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 4dcb86e81769e139ba3215663bfddc6c1b24ae3c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Feb 21 14:54:02 2024 -0600

    [man]: Trivially refactor.
    
    * tmac/an.tmac: Revise mechanism for detecting new page headings that
      should get a top-level bookmark.
    
      (an-end, (initialization)): Make new string
      `an*previous-page-ref-string` empty.
    
      (TH, PT): Drop `an*was-TH-bookmark-emitted` register.
    
      (PT): Compare `an*page-ref-string` to `an*previous-page-ref-string`;
      emit a bookmark if they differ.
---
 ChangeLog    | 12 ++++++++++++
 tmac/an.tmac | 12 +++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a6c5fc2ba..bec0faae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-02-21  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man]: Trivially refactor.
+
+       * tmac/an.tmac: Revise mechanism for detecting new page headings
+       that should get a top-level bookmark.
+       (an-end, (initialization)): Make new string
+       `an*previous-page-ref-string` empty.
+       (TH, PT): Drop `an*was-TH-bookmark-emitted` register.
+       (PT): Compare `an*page-ref-string` to
+       `an*previous-page-ref-string`; emit a bookmark if they differ.
+
 2024-02-21  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [mdoc]: Trivially refactor (DRY).
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 4679a03b2..72352d8cd 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -137,6 +137,7 @@
 .    \}
 .  \}
 .  rr an-TH-was-called
+.  ds an*previous-page-ref-string \" empty
 .  ch an-header
 .  an*break-page-with-new-number
 ..
@@ -365,9 +366,6 @@
 .    DEVTAG-EO-TL
 .  \}
 .
-.  \" A bookmark is attached to the page header, but only on the first
-.  \" page of the document.
-.  nr an*was-TH-bookmark-emitted 0
 .  an-header
 .
 .  if !\\n[cR] \{\
@@ -438,9 +436,11 @@
 .de1 PT
 .  ie \\n[cR] .pl +1v
 .  el         .sp (.5i - .5m)
-.  if !\\n[an*was-TH-bookmark-emitted] \{\
+.  \" Attach a bookmark to the page header on the first page of a new
+.  \" man(7) document; a changed identifier and section indicates this.
+.  if !'\\*[an*page-ref-string]'\\*[an*previous-page-ref-string]' \{\
 .    an*bookmark 1 "\\*[an*page-ref-string]"
-.    nr an*was-TH-bookmark-emitted 1
+.    ds an*previous-page-ref-string \\*[an*page-ref-string]
 .  \}
 .  tl '\\*[an-pageref]'\\*[an-extra3]'\\*[an-pageref]'
 .  ie \\n[cR] \{\
@@ -1375,6 +1375,8 @@ contains unsupported escape sequence
 .nr an-devtag-needs-end-of-heading 0
 .nr an-devtag-needs-second-column 0
 .
+.ds an*previous-page-ref-string \" empty
+.
 .nr an*enforce-tag-separation 1
 .
 .\" Track whether the strings that set header and footer text need to be



reply via email to

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