summaryrefslogtreecommitdiff
path: root/cpan/podlators
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-03-21 08:45:13 +0000
committerDavid Mitchell <davem@iabyn.com>2016-03-21 08:45:13 +0000
commit503c90f6fd25c0a96d3bab0361a7d3e15b87b647 (patch)
treed130c0a59af6f29477c26415b2a9ec00ff01031c /cpan/podlators
parentd1fa969e806dde41212bef100518527143019918 (diff)
downloadperl-503c90f6fd25c0a96d3bab0361a7d3e15b87b647.tar.gz
Integrate podlators 4.07
Diffstat (limited to 'cpan/podlators')
-rw-r--r--cpan/podlators/lib/Pod/Man.pm96
-rw-r--r--cpan/podlators/lib/Pod/ParseLink.pm2
-rw-r--r--cpan/podlators/lib/Pod/Text.pm2
-rw-r--r--cpan/podlators/lib/Pod/Text/Color.pm2
-rw-r--r--cpan/podlators/lib/Pod/Text/Overstrike.pm2
-rw-r--r--cpan/podlators/lib/Pod/Text/Termcap.pm2
-rw-r--r--cpan/podlators/t/man/basic.t33
-rw-r--r--cpan/podlators/t/man/devise-title.t14
8 files changed, 106 insertions, 47 deletions
diff --git a/cpan/podlators/lib/Pod/Man.pm b/cpan/podlators/lib/Pod/Man.pm
index 1829e75757..b739559551 100644
--- a/cpan/podlators/lib/Pod/Man.pm
+++ b/cpan/podlators/lib/Pod/Man.pm
@@ -43,7 +43,7 @@ BEGIN {
@ISA = qw(Pod::Simple);
-$VERSION = '4.06';
+$VERSION = '4.07';
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
@@ -147,9 +147,18 @@ sub new {
delete $$self{errors};
# Degrade back to non-utf8 if Encode is not available.
+ #
+ # Suppress the warning message when PERL_CORE is set, indicating this is
+ # running as part of the core Perl build. Perl builds podlators (and all
+ # pure Perl modules) before Encode and other XS modules, so Encode won't
+ # yet be available. Rely on the Perl core build to generate man pages
+ # later, after all the modules are available, so that UTF-8 handling will
+ # be correct.
if ($$self{utf8} and !$HAS_ENCODE) {
- carp ('utf8 mode requested but Encode module not available,'
- . ' falling back to non-utf8');
+ if (!$ENV{PERL_CORE}) {
+ carp ('utf8 mode requested but Encode module not available,'
+ . ' falling back to non-utf8');
+ }
delete $$self{utf8};
}
@@ -676,10 +685,11 @@ sub switchquotes {
# to Roman rather than the actual previous font when used in headings.
# troff output may still be broken, but at least we can fix nroff by
# just switching the font changes to the non-fixed versions.
- $nroff =~ s/\Q$$self{FONTS}{100}\E(.*?)\\f[PR]/$1/g;
- $nroff =~ s/\Q$$self{FONTS}{101}\E(.*?)\\f([PR])/\\fI$1\\f$2/g;
- $nroff =~ s/\Q$$self{FONTS}{110}\E(.*?)\\f([PR])/\\fB$1\\f$2/g;
- $nroff =~ s/\Q$$self{FONTS}{111}\E(.*?)\\f([PR])/\\f\(BI$1\\f$2/g;
+ my $font_end = "(?:\\f[PR]|\Q$$self{FONTS}{100}\E)";
+ $nroff =~ s/\Q$$self{FONTS}{100}\E(.*?)\\f([PR])/$1/g;
+ $nroff =~ s/\Q$$self{FONTS}{101}\E(.*?)$font_end/\\fI$1\\fP/g;
+ $nroff =~ s/\Q$$self{FONTS}{110}\E(.*?)$font_end/\\fB$1\\fP/g;
+ $nroff =~ s/\Q$$self{FONTS}{111}\E(.*?)$font_end/\\f\(BI$1\\fP/g;
# Now finally output the command. Bother with .ie only if the nroff
# and troff output aren't the same.
@@ -854,44 +864,49 @@ sub devise_title {
}
# If the section isn't 3, then the name defaults to just the basename of
- # the file. Otherwise, assume we're dealing with a module. We want to
- # figure out the full module name from the path to the file, but we don't
- # want to include too much of the path into the module name. Lose
- # anything up to the first off:
- #
- # */lib/*perl*/ standard or site_perl module
- # */*perl*/lib/ from -Dprefix=/opt/perl
- # */*perl*/ random module hierarchy
- #
- # which works. Also strip off a leading site, site_perl, or vendor_perl
- # component, any OS-specific component, and any version number component,
- # and strip off an initial component of "lib" or "blib/lib" since that's
- # what ExtUtils::MakeMaker creates. splitdir requires at least File::Spec
- # 0.8.
+ # the file.
if ($section !~ /^3/) {
require File::Basename;
$name = uc File::Basename::basename ($name);
} else {
require File::Spec;
my ($volume, $dirs, $file) = File::Spec->splitpath ($name);
+
+ # Otherwise, assume we're dealing with a module. We want to figure
+ # out the full module name from the path to the file, but we don't
+ # want to include too much of the path into the module name. Lose
+ # anything up to the first of:
+ #
+ # */lib/*perl*/ standard or site_perl module
+ # */*perl*/lib/ from -Dprefix=/opt/perl
+ # */*perl*/ random module hierarchy
+ #
+ # Also strip off a leading site, site_perl, or vendor_perl component,
+ # any OS-specific component, and any version number component, and
+ # strip off an initial component of "lib" or "blib/lib" since that's
+ # what ExtUtils::MakeMaker creates.
+ #
+ # splitdir requires at least File::Spec 0.8.
my @dirs = File::Spec->splitdir ($dirs);
- my $cut = 0;
- my $i;
- for ($i = 0; $i < @dirs; $i++) {
- if ($dirs[$i] =~ /perl/) {
- $cut = $i + 1;
- $cut++ if ($dirs[$i + 1] && $dirs[$i + 1] eq 'lib');
- last;
+ if (@dirs) {
+ my $cut = 0;
+ my $i;
+ for ($i = 0; $i < @dirs; $i++) {
+ if ($dirs[$i] =~ /perl/) {
+ $cut = $i + 1;
+ $cut++ if ($dirs[$i + 1] && $dirs[$i + 1] eq 'lib');
+ last;
+ }
}
+ if ($cut > 0) {
+ splice (@dirs, 0, $cut);
+ shift @dirs if ($dirs[0] =~ /^(site|vendor)(_perl)?$/);
+ shift @dirs if ($dirs[0] =~ /^[\d.]+$/);
+ shift @dirs if ($dirs[0] =~ /^(.*-$^O|$^O-.*|$^O)$/);
+ }
+ shift @dirs if $dirs[0] eq 'lib';
+ splice (@dirs, 0, 2) if ($dirs[0] eq 'blib' && $dirs[1] eq 'lib');
}
- if ($cut > 0) {
- splice (@dirs, 0, $cut);
- shift @dirs if ($dirs[0] =~ /^(site|vendor)(_perl)?$/);
- shift @dirs if ($dirs[0] =~ /^[\d.]+$/);
- shift @dirs if ($dirs[0] =~ /^(.*-$^O|$^O-.*|$^O)$/);
- }
- shift @dirs if $dirs[0] eq 'lib';
- splice (@dirs, 0, 2) if ($dirs[0] eq 'blib' && $dirs[1] eq 'lib');
# Remove empty directories when building the module name; they
# occur too easily on Unix by doubling slashes.
@@ -1877,6 +1892,13 @@ option was set to C<die>.
=over 4
+=item PERL_CORE
+
+If set and Encode is not available, silently fall back to non-UTF-8 mode
+without complaining to standard error. This environment variable is set
+during Perl core builds, which build Encode after podlators. Encode is
+expected to not (yet) be available in that case.
+
=item POD_MAN_DATE
If set, this will be used as the value of the left-hand footer unless the
@@ -1962,7 +1984,7 @@ mine).
=head1 COPYRIGHT AND LICENSE
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-2009, 2010, 2012, 2013, 2014, 2015 Russ Allbery <rra@cpan.org>
+2009, 2010, 2012, 2013, 2014, 2015, 2016 Russ Allbery <rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
diff --git a/cpan/podlators/lib/Pod/ParseLink.pm b/cpan/podlators/lib/Pod/ParseLink.pm
index b3629df21b..a9e6b34d3a 100644
--- a/cpan/podlators/lib/Pod/ParseLink.pm
+++ b/cpan/podlators/lib/Pod/ParseLink.pm
@@ -31,7 +31,7 @@ use Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(parselink);
-$VERSION = '4.06';
+$VERSION = '4.07';
##############################################################################
# Implementation
diff --git a/cpan/podlators/lib/Pod/Text.pm b/cpan/podlators/lib/Pod/Text.pm
index f15007db57..e141da2fd6 100644
--- a/cpan/podlators/lib/Pod/Text.pm
+++ b/cpan/podlators/lib/Pod/Text.pm
@@ -39,7 +39,7 @@ use Pod::Simple ();
# We have to export pod2text for backward compatibility.
@EXPORT = qw(pod2text);
-$VERSION = '4.06';
+$VERSION = '4.07';
##############################################################################
# Initialization
diff --git a/cpan/podlators/lib/Pod/Text/Color.pm b/cpan/podlators/lib/Pod/Text/Color.pm
index a52d5ca214..b67742e32c 100644
--- a/cpan/podlators/lib/Pod/Text/Color.pm
+++ b/cpan/podlators/lib/Pod/Text/Color.pm
@@ -27,7 +27,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '4.06';
+$VERSION = '4.07';
##############################################################################
# Overrides
diff --git a/cpan/podlators/lib/Pod/Text/Overstrike.pm b/cpan/podlators/lib/Pod/Text/Overstrike.pm
index b8af4f9bd1..1592026e9f 100644
--- a/cpan/podlators/lib/Pod/Text/Overstrike.pm
+++ b/cpan/podlators/lib/Pod/Text/Overstrike.pm
@@ -35,7 +35,7 @@ use Pod::Text ();
@ISA = qw(Pod::Text);
-$VERSION = '4.06';
+$VERSION = '4.07';
##############################################################################
# Overrides
diff --git a/cpan/podlators/lib/Pod/Text/Termcap.pm b/cpan/podlators/lib/Pod/Text/Termcap.pm
index 5336a06444..d533e76ddd 100644
--- a/cpan/podlators/lib/Pod/Text/Termcap.pm
+++ b/cpan/podlators/lib/Pod/Text/Termcap.pm
@@ -28,7 +28,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '4.06';
+$VERSION = '4.07';
##############################################################################
# Overrides
diff --git a/cpan/podlators/t/man/basic.t b/cpan/podlators/t/man/basic.t
index 118f22a972..5ad84b549f 100644
--- a/cpan/podlators/t/man/basic.t
+++ b/cpan/podlators/t/man/basic.t
@@ -2,8 +2,8 @@
#
# Additional specialized tests for Pod::Man.
#
-# Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014
-# Russ Allbery <rra@cpan.org>
+# Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014,
+# 2016 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
@@ -19,7 +19,7 @@ BEGIN {
use strict;
-use Test::More tests => 34;
+use Test::More tests => 35;
BEGIN { use_ok ('Pod::Man') }
# Test whether we can use binmode to set encoding.
@@ -565,3 +565,30 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\s0
###
+
+###
+=head1 Fixed-width Fonts in =item
+
+The nroff portion should not use fixed-width fonts. In podlators 4.06 and
+earlier, italic was terminated with \f(CW, which didn't properly stop italic.
+
+=over 2
+
+=item C<tar I<option>... [I<name>]...>
+
+=item C<tar I<letter>... [I<argument>]... [I<option>]... [I<name>]...>
+
+=back
+###
+.SH "Fixed-width Fonts in =item"
+.IX Header "Fixed-width Fonts in =item"
+The nroff portion should not use fixed-width fonts. In podlators 4.06 and
+earlier, italic was terminated with \ef(\s-1CW,\s0 which didn't properly stop italic.
+.ie n .IP """tar \fIoption\fP... [\fIname\fP]...""" 2
+.el .IP "\f(CWtar \f(CIoption\f(CW... [\f(CIname\f(CW]...\fR" 2
+.IX Item "tar option... [name]..."
+.PD 0
+.ie n .IP """tar \fIletter\fP... [\fIargument\fP]... [\fIoption\fP]... [\fIname\fP]...""" 2
+.el .IP "\f(CWtar \f(CIletter\f(CW... [\f(CIargument\f(CW]... [\f(CIoption\f(CW]... [\f(CIname\f(CW]...\fR" 2
+.IX Item "tar letter... [argument]... [option]... [name]..."
+###
diff --git a/cpan/podlators/t/man/devise-title.t b/cpan/podlators/t/man/devise-title.t
index a98c99e943..afdd550352 100644
--- a/cpan/podlators/t/man/devise-title.t
+++ b/cpan/podlators/t/man/devise-title.t
@@ -3,7 +3,7 @@
# Tests for the automatic determination of the manual page title if not
# specified via options to pod2man or the Pod::Man constructor.
#
-# Copyright 2015 Russ Allbery <rra@cpan.org>
+# Copyright 2015, 2016 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
@@ -14,7 +14,7 @@ use warnings;
use File::Spec;
use IO::File;
-use Test::More tests => 3;
+use Test::More tests => 5;
BEGIN {
use_ok('Pod::Man');
@@ -35,3 +35,13 @@ $parser->parse_file($handle);
my ($name, $section) = $parser->devise_title;
is($name, 'STDIN', 'devise_title uses STDIN for file handle input');
ok($parser->errors_seen, '...and errors were seen');
+
+# Now check handling of a simple file name with no parent directory, which
+# simulates a POD file at the top of a distribution. In podlators 4.06, this
+# produced an erroneous warning. (That wouldn't actually fail this test, but
+# I'd see it during development, which is good enough and doesn't require
+# anything too complicated.)
+$parser->source_filename('Foo.pm');
+($name, $section) = $parser->devise_title;
+is($name, 'Foo', 'devise_title with a simple module name');
+is($section, 3, '...and the correct section');