groff-commit
[Top][All Lists]
Advanced

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

[groff] 26/51: [mdoc]: Align footer management closer to man(7).


From: G. Branden Robinson
Subject: [groff] 26/51: [mdoc]: Align footer management closer to man(7).
Date: Sun, 11 Sep 2022 08:15:52 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 892703b17e088be214c8d0d91db14d2bd6a8dcd5
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Sep 6 23:47:40 2022 -0500

    [mdoc]: Align footer management closer to man(7).
    
    * tmac/doc.tmac (doc-save-global-vars, doc-restore-global-vars):
    * tmac/mdoc/doc-common (Rd):
    * tmac/mdoc/doc-ditroff:
    * tmac/mdoc/doc-nroff: Stop defining, saving, and restoring
      `doc-footer-space`.
    
    * tmac/mdoc/doc-common (doc-break-body-text): New macro, called only
      when not continuously rendering, schedules a page break.
    
      (doc-footer): Stop vertically spacing by `doc-footer-space`, instead
      relying upon a trap to move us here.
    
    * tmac/mdoc/doc-ditroff (doc-setup-header):
    * tmac/mdoc/doc-nroff (doc-setup-header): Set traps at the end of the
      page where man(7) does by default; break the body text at
      1 inch from the page bottom, and write the footer at ½ inch.
    
    * tmac/mdoc/doc-nroff (doc-setup-header): Add 1/6 inch "thin space"
      between man page name and parenthesized section, for precise parity
      with doc-ditroff implementation.  (`\|` does not take up any character
      cells on nroff devices.)
    
    Fixes <https://savannah.gnu.org/bugs/?62774> (6/7).
---
 ChangeLog             | 27 +++++++++++++++++++++++++++
 tmac/doc.tmac         |  2 --
 tmac/mdoc/doc-common  | 10 ++++++++--
 tmac/mdoc/doc-ditroff | 11 ++++-------
 tmac/mdoc/doc-nroff   | 14 ++++++--------
 5 files changed, 45 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5d386f9dd..a0a122372 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2022-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [mdoc]: Align footer management more closely with man(7).
+
+       * tmac/doc.tmac (doc-save-global-vars, doc-restore-global-vars):
+       * tmac/mdoc/doc-common (Rd):
+       * tmac/mdoc/doc-ditroff:
+       * tmac/mdoc/doc-nroff: Stop defining, saving, and restoring
+       `doc-footer-space`.
+
+       * tmac/mdoc/doc-common (doc-break-body-text): New macro, called
+       only when not continuously rendering, schedules a page break.
+       (doc-footer): Stop vertically spacing by `doc-footer-space`,
+       instead relying upon a trap to move us here.
+
+       * tmac/mdoc/doc-ditroff (doc-setup-header):
+       * tmac/mdoc/doc-nroff (doc-setup-header): Set traps at the end
+       of the page where man(7) does by default; break the body text at
+       1 inch from the page bottom, and write the footer at ½ inch.
+
+       * tmac/mdoc/doc-nroff (doc-setup-header): Add 1/6 inch "thin
+       space" between man page name and parenthesized section, for
+       precise parity with doc-ditroff implementation.  (`\|` does not
+       take up any character cells on nroff devices.)
+
+       Fixes <https://savannah.gnu.org/bugs/?62774> (6/7).
+
 2022-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/mdoc/doc-common (Dt, Dd): Emit diagnostic warnings if
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index 0f7e5187a..8a84fb0c2 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -3574,7 +3574,6 @@
 .  ds doc-operating-system-saved "\*[doc-operating-system]
 .  ds doc-date-string-saved "\*[doc-date-string]
 .  nr doc-header-space-saved \n[doc-header-space]
-.  nr doc-footer-space-saved \n[doc-footer-space]
 .  nr doc-display-vertical-saved \n[doc-display-vertical]
 .  ds doc-header-string-saved "\*[doc-header-string]
 .  nr doc-in-see-also-section-saved \n[doc-in-see-also-section]
@@ -3718,7 +3717,6 @@
 .  ds doc-operating-system "\*[doc-operating-system-saved]
 .  ds doc-date-string "\*[doc-date-string-saved]
 .  nr doc-header-space \n[doc-header-space-saved]
-.  nr doc-footer-space \n[doc-footer-space-saved]
 .  nr doc-display-vertical \n[doc-display-vertical-saved]
 .  ds doc-header-string "\*[doc-header-string-saved]
 .  nr doc-in-see-also-section \n[doc-in-see-also-section-saved]
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 988bdd5cd..c92dd3288 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -970,6 +970,14 @@
 .ec
 .
 .
+.\" NS doc-break-body-text
+.\" NS   Schedule a page break when the next output line is written (not
+.\" NS   called if continuously rendering).
+.de doc-break-body-text
+'  bp
+..
+.
+.
 .\" NS doc-footer macro
 .\" NS   print page footer
 .
@@ -977,7 +985,6 @@
 .de doc-footer
 .  ev doc-caption-enviroment
 .  doc-setup-page-layout
-.  sp \n[doc-footer-space]u
 .  ie \n[D] \{\
 .    ie e \
 .      tl 
'%'\*[doc-caption-font2]\*[doc-date-string]\f[]'\*[doc-caption-font]\*[doc-operating-system]\f[]'
@@ -1572,7 +1579,6 @@
 .  tm doc-operating-system == '\*[doc-operating-system]'
 .  tm doc-date-string == '\*[doc-date-string]'
 .  tm doc-header-space == \n[doc-header-space]
-.  tm doc-footer-space == \n[doc-footer-space]
 .  tm doc-display-vertical == \n[doc-display-vertical]
 .  tm doc-header-string == '\*[doc-header-string]'
 .  tm doc-in-synopsis-section == \n[doc-in-synopsis-section]
diff --git a/tmac/mdoc/doc-ditroff b/tmac/mdoc/doc-ditroff
index 2c4d13c67..bda0c869c 100644
--- a/tmac/mdoc/doc-ditroff
+++ b/tmac/mdoc/doc-ditroff
@@ -116,12 +116,6 @@
 .nr doc-header-space .5i
 .
 .
-.\" NS doc-footer-space global register
-.\" NS   the space between body and footer
-.
-.nr doc-footer-space .5i
-.
-.
 .\" NS doc-display-vertical global register
 .\" NS   vertical space between list elements etc.
 .
@@ -190,6 +184,8 @@
 .\" NS
 .\" NS modifies:
 .\" NS   doc-header-string
+.\"
+.\" TODO: Support man(7)'s `FT` register.
 .
 .eo
 .de doc-setup-header
@@ -201,7 +197,8 @@
 .
 .  if !\n[cR] \{\
 .    wh 0 doc-header
-.    wh -1.25i doc-footer
+.    wh -1.0i doc-break-body-text
+.    wh -.5i doc-footer
 .  \}
 .
 .  e@ doc-end-macro
diff --git a/tmac/mdoc/doc-nroff b/tmac/mdoc/doc-nroff
index a9dc1456b..3cfbb71d0 100644
--- a/tmac/mdoc/doc-nroff
+++ b/tmac/mdoc/doc-nroff
@@ -108,12 +108,6 @@
 .nr doc-header-space 1v
 .
 .
-.\" NS doc-footer-space global register
-.\" NS   the space between body and footer
-.
-.nr doc-footer-space 1v
-.
-.
 .\" NS doc-display-vertical global register
 .\" NS   vertical space between list elements etc.
 .
@@ -125,6 +119,7 @@
 .\" NS
 .\" NS modifies:
 .\" NS   doc-display-vertical
+.\" NS   doc-line-length
 .
 .eo
 .de doc-setup-page-layout
@@ -194,18 +189,21 @@
 .\" NS
 .\" NS modifies:
 .\" NS   doc-header-string
+.\"
+.\" TODO: Support man(7)'s `FT` register.
 .
 .eo
 .de doc-setup-header
 .  ds doc-header-string "\*[doc-document-title]
 .  if !"\*[doc-section]"" \
-.    as doc-header-string (\*[doc-section])
+.    as doc-header-string \|(\*[doc-section])
 .
 .  br
 .
 .  if !\n[cR] \{\
 .    wh 0 doc-header
-.    wh -1.167i doc-footer
+.    wh -1.0i doc-break-body-text
+.    wh -.5i doc-footer
 .  \}
 .
 .  e@ doc-end-macro



reply via email to

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