groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/11: [man]: Tidy up interface between an-footer and BT.


From: G. Branden Robinson
Subject: [groff] 04/11: [man]: Tidy up interface between an-footer and BT.
Date: Mon, 16 Aug 2021 00:01:44 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit edb9f4fcbbe7ffeb13004f3551a862407bd55c7a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Aug 15 20:44:12 2021 +1000

    [man]: Tidy up interface between an-footer and BT.
    
    [man]: Clean up the interface between `an-footer` and `BT`, and HTML
    header and footer suppression generally.  Move responsibility for
    checking the `ps4html` register from the latter to the former.  This is
    not something a `BT` redefiner {see groff_man(7)} should have to worry
    about.
    
    * tmac/an.tmac (BT): Drop test of `ps4html` register and early return.
    
      (an-header, an-footer): Return immediately if
      `an-suppress-header-and-footer` is true.  Remove conditional on
      `an-is-output-html`.
    
      (initialization): Define `an-suppress-header-and-footer` register;
      true if `an-is-output-html` is true, or if `ps4html` is defined.
    
    I observe that (AIUI) were it not for the page-number dependence of the
    ps4html method of getting page content into HTML output, we could use
    continuous rendering mode for HTML.
---
 ChangeLog    | 17 +++++++++++++++++
 tmac/an.tmac | 49 +++++++++++++++++++++++++------------------------
 2 files changed, 42 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b1bbb40..eb47071 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2021-08-15  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man]: Clean up the interface between `an-footer` and `BT`, and
+       HTML header and footer suppression generally.  Move
+       responsibility for checking the `ps4html` register from the
+       latter to the former.  This is not something a `BT` redefiner
+       {see groff_man(7)} should have to worry about.
+
+       * tmac/an.tmac (BT): Drop test of `ps4html` register and early
+       return.
+       (an-header, an-footer): Return immediately if
+       `an-suppress-header-and-footer` is true.  Remove conditional on
+       `an-is-output-html`.
+       (initialization): Define `an-suppress-header-and-footer`
+       register; true if `an-is-output-html` is true, or if `ps4html`
+       is defined.
+
 2021-08-13  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/html/pre-html.cpp (get_resolution): Unbrace a
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 29fad52..80ebbae 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -323,8 +323,6 @@
 .
 .\" Write the page footer; can be redefined by man.local.
 .de1 BT
-.  if r ps4html \
-.    return
 .  ie \\n[D] \{\
 .    if o .tl '\\*[an-extra2]'\\*[an-extra1]'\\*[an-outer-footer-text]'
 .    if e .tl '\\*[an-outer-footer-text]'\\*[an-extra1]'\\*[an-extra2]'
@@ -380,21 +378,20 @@
 .
 .\" Prepare the header for a page of the document.
 .de1 an-header
+.  if \\n[an-suppress-header-and-footer] .return
 .  ev an-env-header-or-footer
 .  ps \\n[PS]u
 .  vs \\n[VS]u
 .  lt \\n[LT]u
 .  an-abbreviate-title
-.  if !\\n[an-is-output-html] \{\
-.    ie \\n[cR] .pl +1v
-.    el         .sp .5i
-.    PT
-.    ie \\n[cR] \{\
-.      pl +1v
-.      sp 1v
-.    \}
-.    el .sp |1i
+.  ie \\n[cR] .pl +1v
+.  el         .sp .5i
+.  PT
+.  ie \\n[cR] \{\
+.    pl +1v
+.    sp 1v
 .  \}
+.  el .sp |1i
 .  ev
 .  ns
 ..
@@ -407,27 +404,26 @@
 .
 .\" Prepare the footer for a page of the document.
 .de1 an-footer
+.  if \\n[an-suppress-header-and-footer] .return
 .  ev an-env-header-or-footer
 .  ps \\n[PS]u
 .  vs \\n[VS]u
 .  lt \\n[LT]u
-.  if !\\n[an-is-output-html] \{\
-.    ie \\n[cR] \
-.      ds an-outer-footer-text "\\*[an-pageref]\"
-.    el \{\
-.      ds an-outer-footer-text \\n[%]\"
-.      if r X \{\
-.        if (\\n[%] > \\n[X]) \{\
-.          nr an-page-letter (\\n[%] - \\n[X])
-.          ds an-outer-footer-text \\n[X]\\n[an-page-letter]\"
-.        \}
+.  ie \\n[cR] \
+.    ds an-outer-footer-text "\\*[an-pageref]\"
+.  el \{\
+.    ds an-outer-footer-text \\n[%]\"
+.    if r X \{\
+.      if (\\n[%] > \\n[X]) \{\
+.        nr an-page-letter (\\n[%] - \\n[X])
+.        ds an-outer-footer-text \\n[X]\\n[an-page-letter]\"
 .      \}
 .    \}
-.    if \\n[cR] .pl +1v
-.    BT
 .  \}
-.  ev
+.  if \\n[cR] .pl +1v
+.  BT
 .  rm an-outer-footer-text
+.  ev
 ..
 .
 .\" Output the tag of a tagged paragraph, or of an indented paragraph
@@ -1082,6 +1078,11 @@
 .if \n[cR] \
 .  an-set-up-continuous-rendering
 .
+.\" If rendering HTML, suppress headers and footers.
+.nr an-suppress-header-and-footer 0
+.if \n[an-is-output-html] .nr an-suppress-header-and-footer 1
+.if r ps4html             .nr an-suppress-header-and-footer 1
+.
 .cp \n[*groff_an_tmac_C]
 .do rr *groff_an_tmac_C
 .



reply via email to

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