CC: | aab [...] purdue.edu |
Subject: | Bug(?) in roff generated by Pod::Man/pod2man - |
Date: | Wed, 20 Aug 2014 01:48:43 -0400 (EDT) |
To: | rra [...] stanford.edu, bug-podlators [...] rt.cpan.org |
From: | Paul Townsend <aab [...] purdue.edu> |
Cygwin
groff 1.22.2
perl 5.14.2
Pod::Man 2.25
pod2man --quotes=none
Show quoted text
> cat Z
=head1 NAME
tar - A file archiver tool, version 1.27.1
=head1 SYNOPSIS
The GNU B<tar> program is invoked as either one of:
=over 2
=item C<tar I<option>... [I<name>]...>
=item C<tar I<letter>... [I<argument>]... [I<option>]... [I<name>]...>
=back
Show quoted text> cat script
#!/usr/bin/env bash
X=$1
cat $X
pod2man --quotes=none $X >$X.man
sed -e '1,/^\.TH/d' $X.man # to display pertinent portion of roff file
nroff -man -c $X.man | less # the "..." are underlined in `less's output. Shouldn't be.
sed -e '/^\.ie n \.IP/s,\\f(CW,\\fP,g' $X.man >$X.man2 # replace \f(CI -> \f(CW with \f(CI -> \fP
nroff -man -c $X.man2 | less # the "..." are NOT underlined in `less's output. This is correct.
Show quoted text> script Z # should give examples for comments below.
1) The "..."s should not end up being underlined. I'm not sure why because each italic sequence, \f)CI, is terminated with a \f(CW font change. groff is confused maybe?
2) The font shifts into a new font (\f(CI = italic) are terminated by \f(CW. If I remember correctly from way back when, the \f font change mechanism is implemented as a LIFO queue. The way it's being done by Pod::Man could create a rather large queue at the end of the document not to mention that the resulting font being used after processing those lines approaches being indeterminate. To get around this, the second of each \f pair should be a \fP (revert to the previous font). At the end of processing those lines, nroff/troff should be using the font the was being used before those lines were encountered.
3) The \fR at the end of the troff line should not be there. You don't know that the user actually wants the Roman font. Again \fP.
4) If the \f(CW -> \fP, \f(CI -> \fP sequences were used, I think you could get away with the same roff line for both nroff and troff. Note that \f(CW -> \f(CI -> \fP -> \fP is legal, i.e., you can embed the \f pairs.
-- Thanks,
-- Paul Townsend