groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/10: [man]: Handle degenerate input quietly.


From: G. Branden Robinson
Subject: [groff] 06/10: [man]: Handle degenerate input quietly.
Date: Sat, 30 Oct 2021 19:26:34 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 2a9135c7146e121a07a8c63a9f74dfc60e04f98d
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Oct 30 14:02:11 2021 +1100

    [man]: Handle degenerate input quietly.
    
    * tmac/an.tmac (TH): Define new register `an-TH-was-called`.
    
      (an-end): Return immediately if that register is not defined; to
      format the default page footer we must have the information declared
      in a valid `TH` call.  (`TH` also initializes the type size and
      baseline spacing registers we use to prepare the page footer
      environment.)  If the register _is_ defined, remove it just prior to
      the end of this macro definition, in preparation for next page to be
      rendered.
    
    * tmac/tests/an_handle-degenerate-input-quietly.sh: Test it.
    
    Fixes <https://savannah.gnu.org/bugs/61402>, a regression from groff
    1.22.4 (problem introduced by me in the course of many changes to trap
    management and header/footer handling to work nicely in batch rendering
    with -mandoc and mdoc(7) documents).
---
 ChangeLog    | 20 ++++++++++++++++++++
 tmac/an.tmac |  4 ++++
 2 files changed, 24 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 78fb604..289ba2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2021-10-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man]: Handle degenerate input quietly.
+
+       * tmac/an.tmac (TH): Define new register `an-TH-was-called`.
+       (an-end): Return immediately if that register is not defined;
+       to format the default page footer we must have the information
+       declared in a valid `TH` call.  (`TH` also initializes the type
+       size and baseline spacing registers we use to prepare the page
+       footer environment.)  If the register _is_ defined, remove it
+       just prior to the end of this macro definition, in preparation
+       for next page to be rendered.
+
+       * tmac/tests/an_handle-degenerate-input-quietly.sh: Test it.
+
+       Fixes <https://savannah.gnu.org/bugs/61402>, a regression from
+       groff 1.22.4 (problem introduced by me in the course of many
+       changes to trap management and header/footer handling to work
+       nicely in batch rendering with -mandoc and mdoc(7) documents).
+
 2021-10-28  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [man]: Warn if `TE` table macro called but `TW` register (set by
diff --git a/tmac/an.tmac b/tmac/an.tmac
index f21e90b..b842385 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -103,6 +103,7 @@
 .\" called by andoc when switching to an mdoc(7) page, irrespective of
 .\" continuous rendering mode.
 .de1 an-end
+.  if !r an-TH-was-called .return
 .  if \\n[cR] \{\
 .    fl
 .    pl +1v
@@ -118,6 +119,7 @@
 .      fi
 .    \}
 .  \}
+.  rr an-TH-was-called
 .  ch an-header
 .  bp
 ..
@@ -174,6 +176,8 @@
 .    nr an-is-first-page-of-document 1
 .  \}
 .
+.  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.



reply via email to

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