[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 05/06: [man]: Fix missing page footers when -rcR=1.
From: |
G. Branden Robinson |
Subject: |
[groff] 05/06: [man]: Fix missing page footers when -rcR=1. |
Date: |
Sat, 15 May 2021 20:47:23 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 22809a7600f3e9c35116ed9cbe7ed75d9422ce58
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun May 16 10:36:23 2021 +1000
[man]: Fix missing page footers when -rcR=1.
Fix missing page footers when continuously rendering multiple documents.
Resolving this uncovered entangled header and footer management bugs
with batch processing even when _not_ continuously rendering.
* tmac/an-old.tmac (an-start-new-document): New macro clears header trap
so it doesn't get called with stale information. (The TH macro
already re-sets a header trap with every man page if not continuously
rendering.) This macro also absorbs the break-page and page number
incrementation logic from TH.
(TH): Adapt semantics of "an-first" register to mean not "first page
rendered" (apparently) but "first page of new document". If we are
_not_ on the first page of a new document and the TH macro is called,
we must be batch processing: force the previous man page to end (call
an-end if continuously rendering, or an-start-new-document if not).
After all the header and footer strings have been configured for the
man page, call an-header if we're on the first page of the document,
not (just) if we're continuously rendering. Zero an-first register at
end of macro here unconditionally instead of conditionally in
.an-header.
(an-header): Drop conditional on continuous rendering.
When I batch-render our 62 man pages to the terminal, I do note one
cosmetic regression: the lj4_font(5) page, when continuously rendered in
batch processing, has no space between its header line and first section
heading ("Name"). Another cosmetic issue in this scenario is that the
footers for every rendered page but the last, which had (wrongly) been
absent entirely, are set with no space after them and the header of the
next.
Fixes <https://savannah.gnu.org/bugs/index.php?60609>.
---
ChangeLog | 32 ++++++++++++++++++++++++++++++++
tmac/an-old.tmac | 38 +++++++++++++++++++++++++-------------
2 files changed, 57 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 915a6c8..082dc54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,41 @@
2021-05-16 G. Branden Robinson <g.branden.robinson@gmail.com>
+ [man]: Fix missing page footers when continuously rendering
+ multiple documents. Resolving this uncovered entangled header
+ and footer management bugs with batch processing even when _not_
+ continuously rendering.
+
+ * tmac/an-old.tmac (an-start-new-document): New macro clears
+ header trap so it doesn't get called with stale information.
+ {The TH macro already re-sets a header trap with every man
+ page if not continuously rendering.) This macro also absorbs
+ the break-page and page number incrementation logic from TH.
+ (TH): Adapt semantics of "an-first" register to mean not "first
+ page rendered" (apparently) but "first page of new document".
+ If we are _not_ on the first page of a new document and the TH
+ macro is called, we must be batch processing: force the previous
+ man page to end (call an-end if continuously rendering, or
+ an-start-new-document if not). After all the header and footer
+ strings have been configured for the man page, call an-header if
+ we're on the first page of the document, not (just) if we're
+ continuously rendering. Zero an-first register at end of macro
+ here unconditionally instead of conditionally in .an-header.
+ (an-header): Drop conditional on continuous rendering.
+
+ When I batch-render our 62 man pages to the terminal, I do note
+ one cosmetic regression: the lj4_font(5) page, when continuously
+ rendered in batch processing, has no space between its header
+ line and first section heading ("Name"). Another cosmetic issue
+ in this scenario is that the footers for every rendered page but
+ the last, which had (wrongly) been absent entirely, are set with
+ no space after them and the header of the next.
+
* tmac/tests/an-old_page-footers-present.sh:
* tmac/tests/an-old_page-header-has-current-data.sh: Add man
page header/footer regression tests.
+ Fixes <https://savannah.gnu.org/bugs/index.php?60609>.
+
2021-05-15 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/an-old.tmac (initialization): Key the reprocessing guard
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index 9c8238c..b1e9a27 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -53,7 +53,7 @@
.nr need_eo_h 0
.nr need_col2 0
.
-.nr an-first 1
+.nr an-first 1 \" is this a new man(7) document?
.
.nr an-html 0
.if '\*[.T]'html' .nr an-html 1
@@ -109,10 +109,29 @@
. nr an-saved-prevailing-indent1 \\n[IN]
..
.
+.\" Cause a page transition to a new man(7) document. Clear the page
+.\" header trap so it is not sprung with stale information. Update the
+.\" page number depending on the C (continuous page numbering) register.
+.de an-start-new-document
+. ch an-header
+. ie \\n[C] .bp (\\n[%] + 1)
+. el .bp 1
+..
+.
.\" .TH title section extra1 extra2 extra3
.de1 TH
. if ((\\n[.$] < 2) : (\\n[.$] > 5)) \
. an-style-warn .\\$0 expects 2 to 5 arguments, got \\n[.$]
+.
+. \" If batch processing (rendering multiple) man page documents, we
+. \" must handle the end of a previous document.
+. if !\\n[an-first] \{\
+. ie \\n[cR] .an-end
+. el .an-start-new-document
+. \}
+. nr an-first 1
+. \}
+.
. if \\n[an-html] \{\
. DEVTAG-TL
. nop \\$1
@@ -203,18 +222,17 @@
. rm an-msg
. \}
.
-. ie \\n[cR] \
+. if \\n[an-first] \
. an-header
-. el \{\
+.
+. if !\\n[cR] \{\
. wh 0 an-header
. wh -1i an-footer
. wh \\n[FT]u an-p-footer
-.
-. if \\n[nl] \{\
-. ie \\n[C] .bp (\\n[%] + 1)
-. el .bp 1
. \}
. \}
+.
+. nr an-first 0
..
.
.\" BSD compatibility macros: .AT and .UC
@@ -266,12 +284,6 @@
..
.
.de1 an-header
-. if \\n[cR] \{\
-. ie \\n[an-first] \
-. nr an-first 0
-. el \
-. sp .5i
-. \}
. ev an-1
. ps \\n[PS]u
. vs \\n[VS]u
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 05/06: [man]: Fix missing page footers when -rcR=1.,
G. Branden Robinson <=