Front page | perl.perl5.porters |
Postings from March 2000
[PATCH?] Re: [ID 20000322.006] incorrect pod2man output from long =item paragraphs
Thread Previous
From:
Robin Barker
Date:
March 22, 2000 12:17
Subject:
[PATCH?] Re: [ID 20000322.006] incorrect pod2man output from long =item paragraphs
Message ID:
200003221930.TAA13051@tempest.npl.co.uk
This is a tentative suggestion of a patch which almost fixes
perldoc, by restricting the size of text allowed to .Ip/.IP
{ There is still a strange line break in roll-your-own }
I think a better solution is simply to change the pods so there
was only a short (single) line of text following =item
Robin
--- utils/perldoc.PL.RC3 Wed Mar 22 18:34:36 2000
+++ utils/perldoc.PL Wed Mar 22 18:35:32 2000
@@ -362,7 +362,7 @@
close OUT or die "can't close $tmp: $!";
}
elsif (not $opt_u) {
- my $cmd = "pod2man --lax $file | $opt_n -man";
+ my $cmd = "pod2man --lax --nroff $file | $opt_n -man";
$cmd .= " | col -x" if $^O =~ /hpux/;
my $rslt = `$cmd`;
$rslt = filter_nroff($rslt) if $filter;
--- pod/pod2man.PL.RC3 Wed Mar 22 18:02:19 2000
+++ pod/pod2man.PL Wed Mar 22 18:05:59 2000
@@ -63,7 +63,9 @@
Getopt::Long::config ('bundling_override');
GetOptions (\%options, 'section|s=s', 'release|r=s', 'center|c=s',
'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s',
- 'fixedbolditalic=s', 'official|o', 'lax|l', 'help|h') or exit 1;
+ 'fixedbolditalic=s', 'official|o', 'lax|l', 'help|h',
+ 'itemwidth=i', 'nroff|n',
+ ) or exit 1;
pod2usage (0) if $options{help};
# Official sets --center, but don't override things explicitly set.
--- lib/Pod/Man.pm 2000/03/22 19:16:41 1.1
+++ lib/Pod/Man.pm 2000/03/22 19:20:57
@@ -351,6 +351,10 @@
unless defined $$self{center};
$$self{indent} = 4 unless defined $$self{indent};
+ if( $$self{nroff} ) {
+ $$self{itemwidth} = 72 unless exists $$self{itemwidth};
+ }
+
# We used to try first to get the version number from a local binary,
# but we shouldn't need that any more. Get the version from the running
# Perl. Work a little magic to handle subversions correctly under both
@@ -682,17 +686,29 @@
my $index;
if (/\w/ && !/^\w[.\)]\s*$/) {
$index = $_;
- $index =~ s/^\s*[-*+o.]?\s*//;
+ $index =~ s/^\s*[-*+.]?\s*|^\s*o(\s+|\Z)//;
}
s/^\*(\s|\Z)/\\\(bu$1/;
if ($$self{WEIRDINDENT}) {
$self->output (".RE\n");
$$self{WEIRDINDENT} = 0;
}
+
+ my($longitem,$itemwidth);
+ if( $$self{itemwidth} ) {
+ $itemwidth = $$self{itemwidth} - $$self{INDENT};
+ $longitem = length > $itemwidth;
+ warn "=item text too long:\n$_[0]" if $longitem && !$$self{lax};
+ }
$_ = $self->mapfonts ($_);
+ if( $longitem ) {
+ if( s/^(.{1,$itemwidth})\s+// ) { $longitem = $_; $_ = $1; }
+ else { $longitem = $_; $_ = ''; }
+ }
$self->output (switchquotes ('.Ip', $_, $$self{INDENT}));
$self->outindex ($index ? ('Item', $index) : ());
- $$self{NEEDSPACE} = 0;
+ $self->output ($longitem ."\n") if $longitem;
+ $$self{NEEDSPACE} = !!$longitem;
}
# Begin a block for a particular translator. Setting VERBATIM triggers
Robin
--
Robin Barker | Eail: Robin.Barker@npl.co.uk
CMSC, Building 10, | Phone: +44 (0) 20 8943 7090
National Physical Laboratory, | Fax: +44 (0) 20 8977 7091
Teddington, Middlesex, UK. TW11 OLW | WWW: http://www.npl.co.uk
Thread Previous