summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2003-01-07 08:45:54 +0000
committerhv <hv@crypt.org>2003-01-07 08:45:54 +0000
commit4213be12d365abb31886576a59b48c4839f20a79 (patch)
tree5e557940a8c5bace0121f52694c62c229333db94 /lib/Pod
parent9aa05f5803ebfde70aac285fc58e97e64abbc2b4 (diff)
downloadperl-4213be12d365abb31886576a59b48c4839f20a79.tar.gz
Integrate podlators-1.25
p4raw-id: //depot/perl@18454
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/Man.pm34
-rw-r--r--lib/Pod/t/man.t49
2 files changed, 70 insertions, 13 deletions
diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm
index d2dff0454c..ee374de954 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 <rra@stanford.edu>
+# Copyright 1999, 2000, 2001, 2002, 2003 by Russ Allbery <rra@stanford.edu>
#
# 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<pod2man> by Tom Christiansen <tchrist@mox.perl.com>.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2000, 2001, 2002 by Russ Allbery <rra@stanford.edu>.
+Copyright 1999, 2000, 2001, 2002, 2003 by Russ Allbery <rra@stanford.edu>.
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 8bf7abdcba..f43f32a991 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 <rra@stanford.edu>
+# Copyright 2002, 2003 by Russ Allbery <rra@stanford.edu>
#
# 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.
+###