lib/fmt/fmt_txt.pl: More debugging info if debug is enabled

Show postprocessed groff that will be piped to groff, along
with raw non preprocessed groff.
parent 02a72b40
......@@ -6,7 +6,7 @@
#
# Copyright 1996, Cees de Groot
# Copyright 2001, Taketoshi Sano
# Copyright 2007-2008, Agustin Martin
# Copyright 2007-2009, Agustin Martin
# ---------------------------------------------------
package LinuxDocTools::fmt_txt;
......@@ -314,8 +314,10 @@ $txt->{postASP} = sub
my $txtfile = "$global->{filename}.txt";
my $groffout = "$global->{tmpbase}.groffout";
my $txtout = ( $global->{language} eq "en" ) ? "" : ".nr HY 0\n";
my $txtout0 = "$txtout";
while ( <$INFILE> ) { # Feed $txtout with roff input.
$txtout0 .= $_;
unless (/^\.DS/.../^\.DE/) {
s/^[ \t]{1,}(.*)/$1/g;
}
......@@ -325,6 +327,22 @@ $txt->{postASP} = sub
$txtout .= $_;
}
if ( $global->{debug} ){
my $GROFF0;
my $groff0 = "$global->{tmpbase}.groff.0";
open ( $GROFF0, "> $groff0")
or die "fmt_txt::postASP: Could not open \"$groff0\" for write.\n";
print $GROFF0 $txtout0;
close $GROFF0;
my $GROFF;
my $groff = "$global->{tmpbase}.groff";
open ( $GROFF, "> $groff")
or die "fmt_txt::postASP: Could not open \"$groff\" for write.\n";
print $GROFF $txtout;
close $GROFF;
}
if ( $txt->{manpage} ) {
open ( $OUTFILE, "> $manfile" )
or die "fmt_txt::postASP: Could not open \"$manfile\" for writing\n";
......@@ -332,7 +350,6 @@ $txt->{postASP} = sub
unless ( $global->{pass} ){ # Use old overstrike format
$global->{pass} = $txt->{filter} ? "-P-cbou" : "-P-c";
}
create_temp("$groffout");
my $groffcommand = "| $main::progs->{GROFF} $global->{pass} -T $global->{charset} -t $main::progs->{GROFFMACRO} > $groffout";
open ( $OUTFILE, $groffcommand )
or die "fmt_txt::postASP: Could not open pipe to groff:\n $groffcommand\n";
......
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