groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/06: tmac/an-old.tmac (TH): Add style checks on args.


From: G. Branden Robinson
Subject: [groff] 03/06: tmac/an-old.tmac (TH): Add style checks on args.
Date: Sat, 15 May 2021 20:47:22 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 0e4ebd7b507dbe1bbae967b5be9089514679fa9d
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat May 15 17:12:47 2021 +1000

    tmac/an-old.tmac (TH): Add style checks on args.
    
    * tmac/an-old.tmac (initialization): Stop initializing an-extra[123]
      strings outside of any macro; they need to be reinitialized at every
      TH call when batch rendering.
    
      (TH): Add style warnings for underspecified arguments.
    
    This commit (further) exposes an error in footer management, causing
    tmac/tests/an-old_AT-and-UC-footer-saved-and-restored.sh to fail.  See
    Savannah #60609.
---
 ChangeLog        |  4 ++++
 tmac/an-old.tmac | 28 +++++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 72d0af6..d6ee4f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,10 +10,14 @@
        need it before entering compatibility mode.  Move assignment of
        format of an-page-letter register from a "loose declaration"
        amid macro definitions to within existence test of X register.
+       Stop initializing an-extra[123] strings outside of any macro;
+       they need to be reinitialized at every TH call when batch
+       rendering.
        (TH): Call DT in a less surprising place.
        (TH): Initialize all header/footer-related strings before
        calling header macros, even those not needed for the default
        header configuration.
+       (TH): Add style warnings for underspecified arguments.
        (an-ne): Rename register from "an-need", which is pretty
        confusing in context, to "an-amount", since (1) a (vertical)
        amount is what it is, and (2) it's only used within this macro.
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index e2296a3..9c8238c 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -109,10 +109,6 @@
 .  nr an-saved-prevailing-indent1 \\n[IN]
 ..
 .
-.ds an-extra1 \" empty
-.ds an-extra2 \" empty
-.ds an-extra3 \" empty
-.
 .\" .TH title section extra1 extra2 extra3
 .de1 TH
 .  if ((\\n[.$] < 2) : (\\n[.$] > 5)) \
@@ -183,7 +179,29 @@
 .
 .  ds an-extra1 "\\$3\"
 .  ie (\\n[.$] > 3)    .ds an-extra2 "\\$4\"
-.  el                  .ds an-extra2 \" empty
+.  el                  .ds an-extra2 \" empty; but .AT/.UC can override
+.
+.  if '\\*[an-extra1]'' \{\
+.    ds an-msg .\\$0 missing third argument; suggest document\"
+.    as an-msg " modification date in ISO 8601 format (YYYY-MM-DD)\"
+.    an-style-warn \\*[an-msg]
+.    rm an-msg
+.  \}
+.
+.  if '\\*[an-extra2]'' \{\
+.    ds an-msg .\\$0 missing fourth argument; suggest package/project\"
+.    \" Yes that's one double quote, then three, then two.
+.    as an-msg " name and version (e.g., """groff 1.23.0"")\"
+.    an-style-warn \\*[an-msg]
+.    rm an-msg
+.  \}
+.
+.  if '\\*[an-extra3]'' \{\
+.    ds an-msg .\\$0 missing fifth argument and second argument '\\$2'\"
+.    as an-msg " not a recognized manual section; specify volume title\"
+.    an-style-warn \\*[an-msg]
+.    rm an-msg
+.  \}
 .
 .  ie \\n[cR] \
 .    an-header



reply via email to

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