[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 15/15: [mdoc]: Fix Savannah #65190 (2/2).
From: |
G. Branden Robinson |
Subject: |
[groff] 15/15: [mdoc]: Fix Savannah #65190 (2/2). |
Date: |
Sun, 18 May 2025 13:05:55 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit d8cd70f3a8cfd06996ddce6b1d18150eaef69983
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun May 18 10:35:01 2025 -0500
[mdoc]: Fix Savannah #65190 (2/2).
[mdoc]: Refactor continuous rendering mode to use an "infinite page
length" method facilated by the new semantics of the `.R` register.
* tmac/mdoc/doc-common (doc-ne): Drop unneeded macro.
(doc-bp): Define with `de1` to temporary disable compatibility mode,
and replace definition. No longer altering the page length, it works
like `br`, including control-character-sensitive behavior.
(doc-set-up-continuous-rendering): Drop macro in favor of open-coded
initialization logic.
([initialization]): If continuously rendering, set up replacement
macro for `bp` request and set the page length to "infinite".
(Dd): Call `an*break-page-with-new-number` only if _not_ continuously
rendering.
(doc-end-macro): If continously rendering, stop incrementing the page
length prior to writing the footer and document separation line, and
upon encountering the end of the last document (the input file name
register `.F` becomes empty), set the page length to the vertical
drawing position.
Fixes Savannah #65190 (2/2).
---
ChangeLog | 26 +++++++++++++++++++++++++
tmac/mdoc/doc-common | 54 +++++++++++++---------------------------------------
2 files changed, 39 insertions(+), 41 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7a731473d..795d550a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2025-05-18 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [mdoc]: Refactor continuous rendering mode to use an "infinite
+ page length" method facilated by the new semantics of the `.R`
+ register.
+
+ * tmac/mdoc/doc-common (doc-ne): Drop unneeded macro.
+ (doc-bp): Define with `de1` to temporary disable compatibility
+ mode, and replace definition. No longer altering the page
+ length, it works like `br`, including control-character-
+ sensitive behavior.
+ (doc-set-up-continuous-rendering): Drop macro in favor of
+ open-coded initialization logic.
+ ([initialization]): If continuously rendering, set up
+ replacement macro for `bp` request and set the page length to
+ "infinite".
+ (Dd): Call `an*break-page-with-new-number` only if _not_
+ continuously rendering.
+ (doc-end-macro): If continously rendering, stop incrementing the
+ page length prior to writing the footer and document separation
+ line, and upon encountering the end of the last document (the
+ input file name register `.F` becomes empty), set the page
+ length to the vertical drawing position.
+
+ Fixes Savannah #65190 (2/2).
+
2025-05-18 G. Branden Robinson <g.branden.robinson@gmail.com>
[man]: Refactor continuous rendering mode to use an "infinite
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 3e05449e5..3dc197d1e 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -217,43 +217,20 @@
.\" because they might be called from a context where compatibility mode
.\" is enabled. For other macros, `de` suffices.
.
-.\" Define replacements for requests to handle continuous rendering.
-.\"
-.\" This .ne replacement avoids page breaks; instead, the page length is
-.\" increased to the necessary amount (this is needed for tables).
-.
-.eo
-.de doc-ne
-. ie \n[.$] .nr doc-amount (v;\$*)
-. el .nr doc-amount 1v
-. if (\n[doc-amount] >= \n[.t]) \
-. pl +(\n[doc-amount]u - \n[.t]u + 1v)
-. rr doc-amount
-..
-.ec
-.
-.\" This .bp replacement for continuous rendering mode adjusts the page
-.\" length to the current position so that no empty lines are inserted.
-.
.eo
-.de doc-bp
-. pl \n[nl]u
+.de1 doc-bp
+. if \n[.br] .br
..
.ec
.
.
-.\" NS doc-set-up-continuous-rendering
-.\" Move macros into place for continuous rendering. An end-of-input
-.\" macro is set up by doc-set-up-titles.
-.de doc-set-up-continuous-rendering
-. rn ne doc-real-ne
+.\" In continuous rendering mode, make page breaks less potent and the
+.\" page length "infinite".
+.if \n[cR] \{\
. rn bp doc-real-bp
-. rn doc-ne ne
. rn doc-bp bp
-..
-.
-.if \n[cR] \
-. doc-set-up-continuous-rendering
+. pl \n[.R]u/1v
+.\}
.
.
.\" header assembly macros
@@ -327,7 +304,7 @@
. \" Clear the page header trap so it is not sprung with stale
. \" information.
. ch doc-header
-. doc-break-page-with-new-number
+. if !\n[cR] .doc-break-page-with-new-number
. \}
. if \n[C] .rr P
.
@@ -1169,15 +1146,6 @@
. doc-check-depth
.
. if \n[cR] \{\
-. \" We might have a pending output line that is not yet broken, and
-. \" also be 1v from the bottom of the page. If we break (or flush)
-. \" the output line now, the page will get ejected afterward and
-. \" troff will exit because we're in an end-of-input macro--our
-. \" footer will never be output. So, if that is the case, further
-. \" extend the page length by 1v.
-. if ((\n[.p] - \n[nl]) <= \n[.V]) .pl +1v
-. br
-. pl +1v
. sp 1v
. doc-footer
. \" If we're processing multiple documents and have started a new
@@ -1193,7 +1161,11 @@
. pl \n[nl]u
. \}
. ch doc-header
-. doc-break-page-with-new-number
+. \" At the end of the last document, the file name becomes empty;
+. \" force the page length to match the vertical drawing position in
+. \" continuous rendering mode.
+. ie \\n[cR] .if '\\n[.F]'' .pl \\n[nl]u
+. el .doc-break-page-with-new-number
..
.ec
.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 15/15: [mdoc]: Fix Savannah #65190 (2/2).,
G. Branden Robinson <=