gbranden pushed a commit to branch master
in repository groff.

commit 19d15079a296c2e788871666ec976bbac2454b32
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jul 25 16:06:01 2025 -0500

    tmac/an.tmac: Refactor.
    
    * tmac/an.tmac: (an*reset-text-parameters): New macro configures the
      type size and vertical spacing registers, a task formerly done by
      `TH`, and (re-)sets the font style, type size, vertical spacing, a
      task formerly done by `an*reset-paragraph-parameters`, `TH`, and
      `an*input-trap`.
    
      (an*reset-paragraph-parameters, TH, an*input-trap): Call new macro
      instead of doing the work ourselves.
    
    Fixes <https://savannah.gnu.org/bugs/?67344>.
---
 ChangeLog    | 13 ++++++++++++
 tmac/an.tmac | 68 ++++++++++++++++++++++++++++--------------------------------
 2 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d2d408e00..64556f3f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2025-07-25  G. Branden Robinson <[email protected]>
+
+       * tmac/an.tmac: Refactor.
+       (an*reset-text-parameters): New macro configures the type size
+       and vertical spacing registers, a task formerly done by `TH`,
+       and (re-)sets the font style, type size, vertical spacing, a
+       task formerly done by `an*reset-paragraph-parameters`, `TH`, and
+       `an*input-trap`.
+       (an*reset-paragraph-parameters, TH, an*input-trap): Call new
+       macro instead of doing the work ourselves.
+
+       Fixes <https://savannah.gnu.org/bugs/?67344>.
+
 2025-07-26  G. Branden Robinson <[email protected]>
 
        [man]: Unit-test handling of degerate documents.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 7956a7ed1..89cbbfe90 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -122,6 +122,36 @@
 .  el         .an*break-page-with-new-number
 ..
 .
+.de an*reset-text-parameters
+.  nr PS    10z \" default type size
+.  nr VS    12p \" default vertical spacing
+.
+.  nr PS-SS 10z
+.  nr PS-SH 10.95z
+.
+.  \" Use sizes similar to LaTeX.
+.  if t \{\
+.    ie (\\n[S] = 11) \{\
+.      nr PS    10.95z
+.      nr PS-SS 10.95z
+.      nr PS-SH 12z
+.      nr VS    13.6p
+.    \}
+.    el \{\
+.      if (\\n[S] = 12) \{\
+.        nr PS    12z
+.        nr PS-SS 12z
+.        nr PS-SH 14.4z
+.        nr VS    14.5p
+.      \}
+.    \}
+.  \}
+.
+.  ft R
+.  ps \\n[PS]u
+.  vs \\n[VS]u
+..
+.
 .\" Resetting the hyphenation mode is a complicated dance because:
 .\"   1.  Man pages sometimes disable automatic hyphenation--when they
 .\"       do, they nearly always forget to put it back the way it was;
@@ -166,9 +196,7 @@
 .\" We don't handle the line length here because its handling differs
 .\" between (P, LP, PP, HP) and (IP, TP) paragraphs.
 .de an*reset-paragraph-parameters
-.  ft R
-.  ps \\n[PS]u
-.  vs \\n[VS]u
+.  an*reset-text-parameters
 .  ie d AD .ad \\*[AD]
 .  el      .ad b
 .  an*reset-hyphenation-mode
@@ -267,32 +295,6 @@
 .
 .  nr an-TH-was-called 1 \" an-end can make certain assumptions.
 .
-.  \" Set up rendering parameters.  We do this in TH instead of only
-.  \" once when initializing the package because when rendering multiple
-.  \" pages, a previous page might have changed them.
-.  nr PS    10z \" default type size
-.  nr VS    12p \" default vertical spacing
-.  nr PS-SS 10z
-.  nr PS-SH 10.95z
-.
-.  \" use sizes similar to LaTeX
-.  if t \{\
-.    ie (\\n[S] == 11) \{\
-.      nr PS    10.95z
-.      nr PS-SS 10.95z
-.      nr PS-SH 12z
-.      nr VS    13.6p
-.    \}
-.    el \{\
-.      if (\\n[S] == 12) \{\
-.        nr PS    12z
-.        nr PS-SS 12z
-.        nr PS-SH 14.4z
-.        nr VS    14.5p
-.      \}
-.    \}
-.  \}
-.
 .  \" The previous document rendered in a batch may have been in a
 .  \" different language.
 .  if '\\*[locale]'english' .an*localize-strings
@@ -358,8 +360,6 @@
 .
 .  \" Initialize environment for headers and footers.
 .  ev an*env-header-and-footer
-.  ps \\n[PS]u
-.  vs \\n[VS]u
 .  lt \\n[LT]u
 .  an*abbreviate-page-identifier
 .  \" If AT or UC is called, we will need to abbreviate again.
@@ -677,11 +677,7 @@ contains unsupported escape sequence
 .  nr an-devtag-needs-end-of-heading 0
 .  if \\n[an-devtag-needs-second-column] .DEVTAG-COL 2
 .  nr an-devtag-needs-second-column 0
-.  \" TODO: We might factor this into `an*reset-typeface-parameters` and
-.  \" have `an*reset-paragraph-parameters` call it as well.
-.  ft R
-.  ps \\n[PS]u
-.  vs \\n[VS]u
+.  an*reset-text-parameters
 .  if \\n[an-need-break] \{\
 .    br
 .    nr an-need-break 0

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to