fmt_txt.pl: Put txt output in a single large page. 99999 lines should be enough. (#3180)

There were unpredictable gaps between some environments in txt output.
This looks like a page-break related problem, seems that with previous
code groff is breaking pages in a supposedly continuous text output,
and things are joined in a page-break.

We make sure that groff thinks page is a really large single page, so
the above does not happen. Implemented method was explaind in Groff
mailing list by Anton Shepelev.

First, we set a really large page length and instead of explicitly
resetting pagelength at the end if the file, just use an end-of-input
trap to set the real page-length in the end.

References:

http://lists.gnu.org/archive/html/groff/2011-02/msg00020.html
http://www.groff-wiki.info/EmittingOnePage
parent 1ba3d6f5
......@@ -317,6 +317,21 @@ $txt->{postASP} = sub
my $txtout = ( $global->{language} eq "en" ) ? "" : ".nr HY 0\n";
my $txtout0 = "$txtout";
# Put document in a single large page. 99999 lines should be enough.
$txtout .= q/.\" Trim page to total height of text.
.de sp-adj
. br
. pl \\n[nl]u
..
.
.\" Set single-page mode
.de sp-set
. pl 99999
. em sp-adj
..
.sp-set
/;
while ( <$INFILE> ) { # Feed $txtout with roff input.
$txtout0 .= $_;
unless (/^\.DS/.../^\.DE/) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment