gbranden pushed a commit to branch master
in repository groff.

commit 80ee140eb0616b794b853bbad623263cbea06abc
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Oct 28 15:14:48 2021 +1100

    [man]: Warn if `TE` called but \n[TW] undefined.
    
    [man]: Warn if `TE` table macro but `TW` register (set by tbl(1))
    undefined.  Arrange it so that we warn only once per man(7) document,
    not per table.
    
    * tmac/an.tmac (TH): Remove `TW` register when processing new document
      and clear `an-was-tbl-failure-reported` register.
    
      (TE): Check `TW` and `an-was-tbl-failure-reported` registers; if the
      former is undefined and the latter false, emit the message and set
      `an-was-tbl-failure-reported`.
    
    Addresses part of <https://savannah.gnu.org/bugs/?61379>.  Thanks to
    Bjarni Ingi Gislason for the suggestion.
---
 ChangeLog    | 15 +++++++++++++++
 tmac/an.tmac | 12 ++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index a819e79..0eb9ae3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2021-10-28  G. Branden Robinson <[email protected]>
 
+       [man]: Warn if `TE` table macro but `TW` register (set by
+       tbl(1)) undefined.  Arrange it so that we warn only once per
+       man(7) document, not per table.
+
+       * tmac/an.tmac (TH): Remove `TW` register when processing new
+       document and clear `an-was-tbl-failure-reported` register.
+       (TE): Check `TW` and `an-was-tbl-failure-reported` registers; if
+       the former is undefined and the latter false, emit the message
+       and set `an-was-tbl-failure-reported`.
+
+       Addresses part of <https://savannah.gnu.org/bugs/?61379>.
+       Thanks to Bjarni Ingi Gislason for the suggestion.
+
+2021-10-28  G. Branden Robinson <[email protected]>
+
        [tests]: Improve portability.
 
        * src/devices/grotty/tests/osc8_works.sh: Fix typo in test.
diff --git a/tmac/an.tmac b/tmac/an.tmac
index ff6fc97..f21e90b 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -208,6 +208,10 @@
 .  ll \\n[LL]u
 .  ss 12
 .
+.  \" We've seen no tbl(1) tables yet in this document.
+.  rr TW
+.  nr an-was-tbl-failure-reported 0
+.
 .  an-reset-tab-stops
 .  an-reset-paragraph-spacing
 .  an-reset-margin-and-inset-level
@@ -905,6 +909,14 @@
 .de1 TE
 .  HTML-IMAGE-END
 .  if \\n[an-is-output-html] .ll \\n[an-TS-ll]u
+.  if !r TW .if !\\n[an-was-tbl-failure-reported] \{\
+.    ds an-msg tbl preprocessor failed or was not run;\"
+.    as an-msg " table(s) likely not rendered\"
+.    as an-msg " (TE macro called with TW register undefined)\"
+.    an-warn \\*[an-msg]
+.    rm an-msg
+.    nr an-was-tbl-failure-reported 1
+.  \}
 ..
 .
 .\" eqn(1) equation support

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

Reply via email to