From: Hugo van der Sanden Date: Tue, 7 Jan 2003 08:45:54 +0000 (+0000) Subject: Integrate podlators-1.25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4213be12d365abb31886576a59b48c4839f20a79;p=p5sagit%2Fp5-mst-13.2.git Integrate podlators-1.25 p4raw-id: //depot/perl@18454 --- diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm index d2dff04..ee374de 100644 --- a/lib/Pod/Man.pm +++ b/lib/Pod/Man.pm @@ -1,7 +1,7 @@ # Pod::Man -- Convert POD data to formatted *roff input. -# $Id: Man.pm,v 1.34 2002/07/15 05:46:00 eagle Exp $ +# $Id: Man.pm,v 1.36 2003/01/05 06:32:55 eagle Exp $ # -# Copyright 1999, 2000, 2001, 2002 by Russ Allbery +# Copyright 1999, 2000, 2001, 2002, 2003 by Russ Allbery # # This program is free software; you may redistribute it and/or modify it # under the same terms as Perl itself. @@ -38,7 +38,7 @@ use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION); # Don't use the CVS revision as the version, since this module is also in Perl # core and too many things could munge CVS magic revision strings. This # number should ideally be the same as the CVS revision in podlators, however. -$VERSION = 1.34; +$VERSION = 1.36; ############################################################################## @@ -471,6 +471,7 @@ $_ $$self{INDEX} = []; # Index keys waiting to be printed. $$self{IN_NAME} = 0; # Whether processing the NAME section. $$self{ITEMS} = 0; # The number of consecutive =items. + $$self{ITEMTYPES} = []; # Stack of =item types, one per list. $$self{SHIFTWAIT} = 0; # Whether there is a shift waiting. $$self{SHIFTS} = []; # Stack of .RS shifts. } @@ -537,9 +538,9 @@ sub textblock { $text =~ s/\n\s*$/\n/; # Output the paragraph. We also have to handle =over without =item. If - # there's an =over without =item, NEWINDENT will be set, and we need to - # handle creation of the indent here. Set WEIRDINDENT so that it will be - # cleaned up on =back. + # there's an =over without =item, SHIFTWAIT will be set, and we need to + # handle creation of the indent here. Add the shift to SHIFTS so that it + # will be cleaned up on =back. $self->makespace; if ($$self{SHIFTWAIT}) { $self->output (".RS $$self{INDENT}\n"); @@ -716,6 +717,7 @@ sub cmd_over { push (@{ $$self{SHIFTS} }, $$self{INDENT}); } push (@{ $$self{INDENTS} }, $$self{INDENT}); + push (@{ $$self{ITEMTYPES} }, 'unknown'); $$self{INDENT} = ($_ + 0); $$self{SHIFTWAIT} = 1; } @@ -726,7 +728,9 @@ sub cmd_over { sub cmd_back { my $self = shift; $$self{INDENT} = pop @{ $$self{INDENTS} }; - unless (defined $$self{INDENT}) { + if (defined $$self{INDENT}) { + pop @{ $$self{ITEMTYPES} }; + } else { my ($file, $line, $paragraph) = @_; ($file, $line) = $paragraph->file_line; warn "$file:$line: Unmatched =back\n"; @@ -759,8 +763,18 @@ sub cmd_item { $index = $_; $index =~ s/^\s*[-*+o.]?(?:\s+|\Z)//; } - $_ = '*' unless $_; - s/^\*(\s|\Z)/\\\(bu$1/; + $_ = '*' unless length ($_) > 0; + my $type = $$self{ITEMTYPES}[0]; + unless (defined $type) { + my ($file, $line, $paragraph) = @_; + ($file, $line) = $paragraph->file_line; + $type = 'unknown'; + } + if ($type eq 'unknown') { + $type = /^\*\s*\Z/ ? 'bullet' : 'text'; + $$self{ITEMTYPES}[0] = $type if $$self{ITEMTYPES}[0]; + } + s/^\*\s*\Z/\\\(bu/ if $type eq 'bullet'; if (@{ $$self{SHIFTS} } == @{ $$self{INDENTS} }) { $self->output (".RE\n"); pop @{ $$self{SHIFTS} }; @@ -1387,7 +1401,7 @@ B by Tom Christiansen . =head1 COPYRIGHT AND LICENSE -Copyright 1999, 2000, 2001, 2002 by Russ Allbery . +Copyright 1999, 2000, 2001, 2002, 2003 by Russ Allbery . This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Pod/t/man.t b/lib/Pod/t/man.t index 8bf7abd..f43f32a 100644 --- a/lib/Pod/t/man.t +++ b/lib/Pod/t/man.t @@ -1,9 +1,9 @@ #!/usr/bin/perl -w -# $Id: man.t,v 1.2 2002/06/23 19:16:25 eagle Exp $ +# $Id: man.t,v 1.4 2003/01/05 06:31:52 eagle Exp $ # # man.t -- Additional specialized tests for Pod::Man. # -# Copyright 2002 by Russ Allbery +# Copyright 2002, 2003 by Russ Allbery # # This program is free software; you may redistribute it and/or modify it # under the same terms as Perl itself. @@ -17,7 +17,7 @@ BEGIN { } unshift (@INC, '../blib/lib'); $| = 1; - print "1..3\n"; + print "1..5\n"; } END { @@ -94,3 +94,46 @@ This C<.> should be quoted. .IX Header "PERIODS" This \f(CW\*(C`.\*(C'\fR should be quoted. ### + +### +=over 4 + +=item * + +A bullet. + +=item * + +Another bullet. + +=item * Not a bullet. + +=back +### +.IP "\(bu" 4 +A bullet. +.IP "\(bu" 4 +Another bullet. +.IP "* Not a bullet." 4 +.IX Item "Not a bullet." +### + +### +=over 4 + +=item foo + +Not a bullet. + +=item * + +Also not a bullet. + +=back +### +.IP "foo" 4 +.IX Item "foo" +Not a bullet. +.IP "*" 4 +Also not a bullet. +###