Skip to content

Commit

Permalink
Upgrade to podlators 2.0.6
Browse files Browse the repository at this point in the history
p4raw-id: //depot/perl@32551
  • Loading branch information
rgs committed Nov 29, 2007
1 parent 13fbb5b commit 40dcca8
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 31 deletions.
39 changes: 27 additions & 12 deletions lib/Pod/Man.pm
@@ -1,7 +1,7 @@
# Pod::Man -- Convert POD data to formatted *roff input.
# $Id: Man.pm,v 2.12 2006-09-16 20:55:41 eagle Exp $
# $Id: Man.pm,v 2.16 2007-11-29 01:35:53 eagle Exp $
#
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Russ Allbery <rra@stanford.edu>
# Substantial contributions by Sean Burke <sburke@cpan.org>
#
Expand Down Expand Up @@ -40,7 +40,7 @@ use POSIX qw(strftime);
# 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 = '2.12_01';
$VERSION = '2.16';

# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
Expand Down Expand Up @@ -333,6 +333,7 @@ sub formatting {
$options{cleanup} = 0;
} elsif ($element eq 'Verbatim' || $element eq 'C') {
$options{guesswork} = 0;
$options{literal} = 1;
}
return \%options;
}
Expand All @@ -345,6 +346,7 @@ sub format_text {
my $guesswork = $$options{guesswork} && !$$self{IN_NAME};
my $cleanup = $$options{cleanup};
my $convert = $$options{convert};
my $literal = $$options{literal};

# Normally we do character translation, but we won't even do that in
# <Data> blocks.
Expand All @@ -363,6 +365,13 @@ sub format_text {
$text =~ s/_(?=_)/_\\|/g;
}

# Ensure that *roff doesn't convert literal quotes to UTF-8 single quotes,
# but don't mess up our accept escapes.
if ($literal) {
$text =~ s/(?<!\\\*)\'/\\*\(Aq/g;
$text =~ s/(?<!\\\*)\`/\\\`/g;
}

# If guesswork is asked for, do that. This involves more substantial
# formatting based on various heuristics that may only be appropriate for
# particular documents.
Expand Down Expand Up @@ -391,7 +400,8 @@ sub quote_literal {
^\s*
(?:
( [\'\`\"] ) .* \1 # already quoted
| \` .* \' # `quoted'
| \\\*\(Aq .* \\\*\(Aq # quoted and escaped
| \\?\` .* ( \' | \\\*\(Aq ) # `quoted'
| \$+ [\#^]? \S $index # special ($^Foo, $")
| [\$\@%&*]+ \#? [:\'\w]+ $index # plain var or func
| [\$\@%&*]* [:\'\w]+ (?: -> )? \(\s*[^\s,]\s*\) # 0/1-arg func call
Expand Down Expand Up @@ -791,13 +801,10 @@ sub devise_title {
my @dirs = File::Spec->splitdir ($dirs);
my $cut = 0;
my $i;
for ($i = 0; $i < scalar @dirs; $i++) {
if ($dirs[$i] eq 'lib' && $i+1 < scalar(@dirs) && $dirs[$i + 1] =~ /perl/) {
$cut = $i + 2;
last;
} elsif ($dirs[$i] =~ /perl/) {
for ($i = 0; $i < @dirs; $i++) {
if ($dirs[$i] =~ /perl/) {
$cut = $i + 1;
$cut++ if $dirs[$i + 1] eq 'lib';
$cut++ if ($dirs[$i + 1] && $dirs[$i + 1] eq 'lib');
last;
}
}
Expand Down Expand Up @@ -1346,17 +1353,25 @@ sub preamble_template {
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
Expand Down Expand Up @@ -1657,7 +1672,7 @@ mine).
=head1 COPYRIGHT AND LICENSE
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
by Russ Allbery <rra@stanford.edu>.
This program is free software; you may redistribute it and/or modify it
Expand Down
12 changes: 6 additions & 6 deletions lib/Pod/t/basic.man
Expand Up @@ -230,7 +230,7 @@ the first < seen.
Lets make sure these work for empty ones too, like \f(CW\*(C`\*(C'\fR and \f(CW\*(C`>>\*(C'\fR
(just to be obnoxious)
.PP
The statement: \f(CW\*(C`This is dog kind's \f(CIfinest\f(CW hour!\*(C'\fR is a parody of a
The statement: \f(CW\*(C`This is dog kind\*(Aqs \f(CIfinest\f(CW hour!\*(C'\fR is a parody of a
quotation from Winston Churchill.
.PP
The following tests are added to those:
Expand Down Expand Up @@ -264,16 +264,16 @@ Throw in a few verbatim paragraphs.
.PP
.Vb 8
\& use Term::ANSIColor;
\& print color 'bold blue';
\& print color \*(Aqbold blue\*(Aq;
\& print "This text is bold blue.\en";
\& print color 'reset';
\& print color \*(Aqreset\*(Aq;
\& print "This text is normal.\en";
\& print colored ("Yellow on magenta.\en", 'yellow on_magenta');
\& print colored ("Yellow on magenta.\en", \*(Aqyellow on_magenta\*(Aq);
\& print "This text is normal.\en";
\& print colored ['yellow on_magenta'], "Yellow on magenta.\en";
\& print colored [\*(Aqyellow on_magenta\*(Aq], "Yellow on magenta.\en";
\&
\& use Term::ANSIColor qw(uncolor);
\& print uncolor '01;31', "\en";
\& print uncolor \*(Aq01;31\*(Aq, "\en";
.Ve
.PP
But this isn't verbatim (make sure it wraps properly), and the next
Expand Down
28 changes: 18 additions & 10 deletions lib/Pod/t/man.t
@@ -1,9 +1,9 @@
#!/usr/bin/perl -w
# $Id: man.t,v 1.10 2006-09-16 20:25:25 eagle Exp $
# $Id: man.t,v 1.12 2007-11-29 01:35:54 eagle Exp $
#
# man.t -- Additional specialized tests for Pod::Man.
#
# Copyright 2002, 2003, 2004, 2006 by Russ Allbery <rra@stanford.edu>
# Copyright 2002, 2003, 2004, 2006, 2007 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.
Expand All @@ -17,7 +17,7 @@ BEGIN {
}
unshift (@INC, '../blib/lib');
$| = 1;
print "1..21\n";
print "1..22\n";
}

END {
Expand All @@ -29,21 +29,19 @@ use Pod::Man;
$loaded = 1;
print "ok 1\n";

my $have_encoding = eval { require PerlIO::encoding; 1; } && ! $@;

my $parser = Pod::Man->new or die "Cannot create parser\n";
my $n = 2;
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";

# We have a test in ISO 8859-1 encoding. Make sure that nothing strange
# happens if Perl thinks the world is Unicode.
binmode (\*TMP, ':encoding(iso-8859-1)') if $have_encoding;
# happens if Perl thinks the world is Unicode. Wrap this in eval so that
# older versions of Perl don't croak.
eval { binmode (\*TMP, ':encoding(iso-8859-1)') };

while (<DATA>) {
last if $_ eq "###\n";
no warnings 'utf8';
print TMP $_;
}
close TMP;
Expand Down Expand Up @@ -359,8 +357,8 @@ Blorp C<'
###
.SH "Newline C Quote Weirdness"
.IX Header "Newline C Quote Weirdness"
Blorp \f(CW'
\&''\fR. Yes.
Blorp \f(CW\*(Aq
\&\*(Aq\*(Aq\fR. Yes.
###
###
Expand Down Expand Up @@ -423,3 +421,13 @@ $-0.13 should have a real hyphen.
Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However,
$\-0.13 should have a real hyphen.
###
###
=head1 Quote escaping
Don't escape `this' but do escape C<`this'> (and don't surround it in quotes).
###
.SH "Quote escaping"
.IX Header "Quote escaping"
Don't escape `this' but do escape \f(CW\`this\*(Aq\fR (and don't surround it in quotes).
###
19 changes: 16 additions & 3 deletions lib/Pod/t/text.t
@@ -1,9 +1,9 @@
#!/usr/bin/perl -w
# $Id: text.t,v 1.5 2006-01-28 22:31:50 eagle Exp $
# $Id: text.t,v 1.6 2007-09-12 00:20:08 eagle Exp $
#
# text.t -- Additional specialized tests for Pod::Text.
#
# Copyright 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu>
# Copyright 2002, 2004, 2006, 2007 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.
Expand All @@ -17,14 +17,15 @@ BEGIN {
}
unshift (@INC, '../blib/lib');
$| = 1;
print "1..3\n";
print "1..4\n";
}

END {
print "not ok 1\n" unless $loaded;
}

use Pod::Text;
use Pod::Simple;

$loaded = 1;
print "ok 1\n";
Expand Down Expand Up @@ -57,6 +58,8 @@ while (<DATA>) {
}
if ($output eq $expected) {
print "ok $n\n";
} elsif ($n == 4 && $Pod::Simple::VERSION < 3.06) {
print "ok $n # skip Pod::Simple S<> parsing bug\n";
} else {
print "not ok $n\n";
print "Expected\n========\n$expected\nOutput\n======\n$output\n";
Expand Down Expand Up @@ -89,3 +92,13 @@ C<> WITH SPACES
What does "this." end up looking like?
###
###
=head1 Test of SE<lt>E<gt>
This is some S< > whitespace.
###
Test of S<>
This is some whitespace.
###
==

0 comments on commit 40dcca8

Please sign in to comment.