summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-29 10:21:22 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-29 10:21:22 +0000
commit40dcca8acfd632ef78333419c9eb620512621633 (patch)
tree8e073a469a56ab9f3e1e865057c4406969dabe04 /lib/Pod
parent13fbb5b173fcf8b7f4bfad9ead184335a89f5f9f (diff)
downloadperl-40dcca8acfd632ef78333419c9eb620512621633.tar.gz
Upgrade to podlators 2.0.6
p4raw-id: //depot/perl@32551
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/Man.pm39
-rw-r--r--lib/Pod/t/basic.man12
-rw-r--r--lib/Pod/t/man.t28
-rw-r--r--lib/Pod/t/text.t19
4 files changed, 67 insertions, 31 deletions
diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm
index a8b41bbf26..451ecc80f0 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 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>
#
@@ -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
@@ -333,6 +333,7 @@ sub formatting {
$options{cleanup} = 0;
} elsif ($element eq 'Verbatim' || $element eq 'C') {
$options{guesswork} = 0;
+ $options{literal} = 1;
}
return \%options;
}
@@ -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.
@@ -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.
@@ -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
@@ -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;
}
}
@@ -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.
@@ -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
diff --git a/lib/Pod/t/basic.man b/lib/Pod/t/basic.man
index a60a0aa587..9c2248e935 100644
--- a/lib/Pod/t/basic.man
+++ b/lib/Pod/t/basic.man
@@ -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:
@@ -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
diff --git a/lib/Pod/t/man.t b/lib/Pod/t/man.t
index 3ad1f83141..5d4d2315b6 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.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.
@@ -17,7 +17,7 @@ BEGIN {
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..21\n";
+ print "1..22\n";
}
END {
@@ -29,8 +29,6 @@ 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>) {
@@ -38,12 +36,12 @@ while (<DATA>) {
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;
@@ -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.
###
###
@@ -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).
+###
diff --git a/lib/Pod/t/text.t b/lib/Pod/t/text.t
index cbe37828ad..b1995f29e4 100644
--- a/lib/Pod/t/text.t
+++ b/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.
@@ -17,7 +17,7 @@ BEGIN {
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..3\n";
+ print "1..4\n";
}
END {
@@ -25,6 +25,7 @@ END {
}
use Pod::Text;
+use Pod::Simple;
$loaded = 1;
print "ok 1\n";
@@ -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";
@@ -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.
+###
+==