summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Pod
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-04-23 21:46:20 +0000
committerKarl Berry <karl@freefriends.org>2014-04-23 21:46:20 +0000
commit300c1eb6d37d46078d448d6d58938d5a80cd68ff (patch)
tree23a0a8b9f8f5460b405119c4d3c163d2d488ca5e /Master/tlpkg/tlperl/lib/Pod
parented55d86b7c5e18f6eccce80a1fb1423ca40a23b5 (diff)
(tl)perl 5.18.2 for windows from siep
git-svn-id: svn://tug.org/texlive/trunk@33648 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Pod')
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Checker.pm7
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Find.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Functions.pm8
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Html.pm11
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/InputObjects.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/LaTeX.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Man.pm182
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/ParseUtils.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Parser.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc.pm8
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm13
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/PlainText.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Select.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple.pm51
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm63
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm5
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm17
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm8
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParser.pm21
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/TiedOutFH.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Transcode.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeDumb.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeSmart.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm93
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm5
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Text.pm126
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Text/Color.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Text/Overstrike.pm18
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Text/Termcap.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Usage.pm628
56 files changed, 888 insertions, 516 deletions
diff --git a/Master/tlpkg/tlperl/lib/Pod/Checker.pm b/Master/tlpkg/tlperl/lib/Pod/Checker.pm
index 25dab197b04..2bff3c9c4c9 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Checker.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Checker.pm
@@ -11,7 +11,7 @@ package Pod::Checker;
use strict;
use vars qw($VERSION @ISA @EXPORT %VALID_COMMANDS %VALID_SEQUENCES);
-$VERSION = '1.51'; ## Current version of this package
+$VERSION = '1.60'; ## Current version of this package
require 5.005; ## requires this Perl version or later
use Pod::ParseUtils; ## for hyperlinks and lists
@@ -24,7 +24,7 @@ Pod::Checker, podchecker() - check pod documents for syntax errors
use Pod::Checker;
- $syntax_okay = podchecker($filepath, $outputpath, %options);
+ $num_errors = podchecker($filepath, $outputpath, %options);
my $checker = new Pod::Checker %options;
$checker->parse_from_file($filepath, \*STDERR);
@@ -1323,7 +1323,8 @@ Marek Rouchal E<lt>marekr@cpan.orgE<gt>
Based on code for B<Pod::Text::pod2text()> written by
Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
-B<Pod::Checker> is part of the L<Pod::Parser> distribution.
+B<Pod::Checker> is part of the Pod-Checker distribution, and is based on
+L<Pod::Parser>.
=cut
diff --git a/Master/tlpkg/tlperl/lib/Pod/Find.pm b/Master/tlpkg/tlperl/lib/Pod/Find.pm
index 028a405c79e..157caf23a31 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Find.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Find.pm
@@ -14,7 +14,7 @@ package Pod::Find;
use strict;
use vars qw($VERSION);
-$VERSION = '1.51'; ## Current version of this package
+$VERSION = '1.60'; ## Current version of this package
require 5.005; ## requires this Perl version or later
use Carp;
diff --git a/Master/tlpkg/tlperl/lib/Pod/Functions.pm b/Master/tlpkg/tlperl/lib/Pod/Functions.pm
index 47b2bafc357..6ae7ae4bfe5 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Functions.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Functions.pm
@@ -54,7 +54,7 @@ L<perlfunc/"Perl Functions by Category"> section.
=cut
-our $VERSION = '1.05';
+our $VERSION = '1.06';
require Exporter;
@@ -134,7 +134,7 @@ bind Socket binds an address to a socket
binmode I/O prepare binary files for I/O
bless Objects create an object
break Flow break out of a C<given> block
-caller Flow Namespace get context of the current subroutine call
+caller Namespace Flow get context of the current subroutine call
chdir File change your current working directory
chmod File changes the permissions on a list of files
chomp String remove a trailing record separator from a string
@@ -218,7 +218,7 @@ kill Process send a signal to a process or process group
last Flow exit a block prematurely
lc String return lower-case version of a string
lcfirst String return a string with just the next letter in lower case
-length String return the number of bytes in a string
+length String return the number of characters in a string
__LINE__ Flow the current source line number
link File create a hard link in the filesystem
listen Socket register your socket as a server
@@ -344,7 +344,7 @@ utime File set a file's last access and modify times
values HASH ARRAY return a list of the values in a hash
vec Binary test or set particular bits in a string
wait Process wait for any child process to die
-waitpid Process wait for a particular child process to die
+waitpid Process wait for a particular child process to die
wantarray Flow get void vs scalar vs list context of current subroutine call
warn I/O print debugging info
write I/O print a picture record
diff --git a/Master/tlpkg/tlperl/lib/Pod/Html.pm b/Master/tlpkg/tlperl/lib/Pod/Html.pm
index 47b937abbb5..72b37c249dd 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Html.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Html.pm
@@ -3,7 +3,7 @@ use strict;
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION = 1.15_02;
+$VERSION = 1.18;
@ISA = qw(Exporter);
@EXPORT = qw(pod2html htmlify);
@EXPORT_OK = qw(anchorify);
@@ -16,8 +16,11 @@ use File::Spec;
use File::Spec::Unix;
use Getopt::Long;
use Pod::Simple::Search;
-
-use locale; # make \w work right in non-ASCII lands
+BEGIN {
+ if($Config{d_setlocale}) {
+ require locale; import locale; # make \w work right in non-ASCII lands
+ }
+}
=head1 NAME
@@ -432,6 +435,7 @@ HTMLFOOT
} else {
open $fhout, ">-";
}
+ binmode $fhout, ":utf8";
print $fhout $output;
close $fhout or die "Failed to close $Htmlfile: $!";
chmod 0644, $Htmlfile unless $Htmlfile eq '-';
@@ -695,6 +699,7 @@ sub _unixify {
$full_path = File::Spec::Unix->catfile(File::Spec::Unix->catdir(@dirs),
$file);
$full_path =~ s|^\/|| if $^O eq 'MSWin32'; # C:/foo works, /C:/foo doesn't
+ $full_path =~ s/\^\././g if $^O eq 'VMS'; # unescape dots
return $full_path;
}
diff --git a/Master/tlpkg/tlperl/lib/Pod/InputObjects.pm b/Master/tlpkg/tlperl/lib/Pod/InputObjects.pm
index 2ed71fa2551..d72865037c8 100644
--- a/Master/tlpkg/tlperl/lib/Pod/InputObjects.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/InputObjects.pm
@@ -12,7 +12,7 @@ package Pod::InputObjects;
use strict;
use vars qw($VERSION);
-$VERSION = '1.51'; ## Current version of this package
+$VERSION = '1.60'; ## Current version of this package
require 5.005; ## requires this Perl version or later
#############################################################################
diff --git a/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm b/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm
index f4b1aaf97b9..fc6d99dd979 100644
--- a/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm
@@ -28,12 +28,14 @@ use strict;
require Pod::ParseUtils;
use base qw/ Pod::Select /;
+use if $] > 5.017, 'deprecate';
+
# use Data::Dumper; # for debugging
use Carp;
use vars qw/ $VERSION %HTML_Escapes @LatexSections /;
-$VERSION = '0.60';
+$VERSION = '0.61';
# Definitions of =headN -> latex mapping
@LatexSections = (qw/
diff --git a/Master/tlpkg/tlperl/lib/Pod/Man.pm b/Master/tlpkg/tlperl/lib/Pod/Man.pm
index 96f3fccee72..5e5f4dc4de2 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Man.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Man.pm
@@ -1,12 +1,5 @@
# Pod::Man -- Convert POD data to formatted *roff input.
#
-# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-# 2010 Russ Allbery <rra@stanford.edu>
-# Substantial contributions by Sean Burke <sburke@cpan.org>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
# This module translates POD documentation into *roff markup using the man
# macro set, and is intended for converting POD documents written as Unix
# manual pages to manual pages that can be read by the man(1) command. It is
@@ -17,6 +10,13 @@
# maintained outside of the Perl core as part of the podlators. Please send
# me any patches at the address above in addition to sending them to the
# standard Perl mailing lists.
+#
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+# 2010, 2012, 2013 Russ Allbery <rra@stanford.edu>
+# Substantial contributions by Sean Burke <sburke@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
##############################################################################
# Modules and declarations
@@ -36,7 +36,7 @@ use Pod::Simple ();
@ISA = qw(Pod::Simple);
-$VERSION = '2.25';
+$VERSION = '2.27';
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
@@ -93,11 +93,30 @@ sub new {
%$self = (%$self, @_);
# Send errors to stderr if requested.
- if ($$self{stderr}) {
+ if ($$self{stderr} and not $$self{errors}) {
+ $$self{errors} = 'stderr';
+ }
+ delete $$self{stderr};
+
+ # Validate the errors parameter and act on it.
+ if (not defined $$self{errors}) {
+ $$self{errors} = 'pod';
+ }
+ if ($$self{errors} eq 'stderr' || $$self{errors} eq 'die') {
$self->no_errata_section (1);
$self->complain_stderr (1);
- delete $$self{stderr};
+ if ($$self{errors} eq 'die') {
+ $$self{complain_die} = 1;
+ }
+ } elsif ($$self{errors} eq 'pod') {
+ $self->no_errata_section (0);
+ $self->complain_stderr (0);
+ } elsif ($$self{errors} eq 'none') {
+ $self->no_whining (1);
+ } else {
+ croak (qq(Invalid errors setting: "$$self{errors}"));
}
+ delete $$self{errors};
# Initialize various other internal constants based on our arguments.
$self->init_fonts;
@@ -474,11 +493,16 @@ sub guesswork {
# line or following regular punctuation (like quotes) or whitespace (1),
# and followed by either similar punctuation, an em-dash, or the end of
# the line (3).
+ #
+ # Allow the text we're changing to small caps to include double quotes,
+ # commas, newlines, and periods as long as it doesn't otherwise interrupt
+ # the string of small caps and still fits the criteria. This lets us turn
+ # entire warranty disclaimers in man page output into small caps.
if ($$self{MAGIC_SMALLCAPS}) {
s{
- ( ^ | [\s\(\"\'\`\[\{<>] | \\\ ) # (1)
- ( [A-Z] [A-Z] (?: [/A-Z+:\d_\$&] | \\- )* ) # (2)
- (?= [\s>\}\]\(\)\'\".?!,;] | \\*\(-- | \\\ | $ ) # (3)
+ ( ^ | [\s\(\"\'\`\[\{<>] | \\[ ] ) # (1)
+ ( [A-Z] [A-Z] (?: [/A-Z+:\d_\$&] | \\- | [.,\"\s] )* ) # (2)
+ (?= [\s>\}\]\(\)\'\".?!,;] | \\*\(-- | \\[ ] | $ ) # (3)
} {
$1 . '\s-1' . $2 . '\s0'
}egx;
@@ -715,6 +739,7 @@ sub outindex {
# Print out the .IX commands.
for (@output) {
my ($type, $entry) = @$_;
+ $entry =~ s/\s+/ /g;
$entry =~ s/\"/\"\"/g;
$entry =~ s/\\/\\\\/g;
$self->output (".IX $type " . '"' . $entry . '"' . "\n");
@@ -743,6 +768,8 @@ sub start_document {
DEBUG and print "Document is contentless\n";
$$self{CONTENTLESS} = 1;
return;
+ } else {
+ delete $$self{CONTENTLESS};
}
# When UTF-8 output is set, check whether our output file handle already
@@ -753,8 +780,9 @@ sub start_document {
if ($$self{utf8}) {
$$self{ENCODE} = 1;
eval {
- my @layers = PerlIO::get_layers ($$self{output_fh});
- if (grep { $_ eq 'utf8' } @layers) {
+ my @options = (output => 1, details => 1);
+ my $flag = (PerlIO::get_layers ($$self{output_fh}, @options))[-1];
+ if ($flag & PerlIO::F_UTF8 ()) {
$$self{ENCODE} = 0;
}
}
@@ -784,10 +812,14 @@ sub start_document {
$$self{PENDING} = [[]]; # Pending output.
}
-# Handle the end of the document. This does nothing but print out a final
-# comment at the end of the document under debugging.
+# Handle the end of the document. This handles dying on POD errors, since
+# Pod::Parser currently doesn't. Otherwise, does nothing but print out a
+# final comment at the end of the document under debugging.
sub end_document {
my ($self) = @_;
+ if ($$self{complain_die} && $self->errors_seen) {
+ croak ("POD document had syntax errors");
+ }
return if $self->bare_output;
return if ($$self{CONTENTLESS} && !$$self{ALWAYS_EMIT_SOMETHING});
$self->output (q(.\" [End document]) . "\n") if DEBUG;
@@ -1106,12 +1138,21 @@ sub cmd_x {
}
# Links reduce to the text that we're given, wrapped in angle brackets if it's
-# a URL.
+# a URL, followed by the URL. We take an option to suppress the URL if anchor
+# text is given. We need to format the "to" value of the link before
+# comparing it to the text since we may escape hyphens.
sub cmd_l {
my ($self, $attrs, $text) = @_;
if ($$attrs{type} eq 'url') {
- if (not defined($$attrs{to}) or $$attrs{to} eq $text) {
+ my $to = $$attrs{to};
+ if (defined $to) {
+ my $tag = $$self{PENDING}[-1];
+ $to = $self->format_text ($$tag[1], $to);
+ }
+ if (not defined ($to) or $to eq $text) {
return "<$text>";
+ } elsif ($$self{nourls}) {
+ return $text;
} else {
return "$text <$$attrs{to}>";
}
@@ -1299,7 +1340,18 @@ sub parse_from_file {
# parse_from_file supports.
sub parse_from_filehandle {
my $self = shift;
- $self->parse_from_file (@_);
+ return $self->parse_from_file (@_);
+}
+
+# Pod::Simple's parse_file doesn't set output_fh. Wrap the call and do so
+# ourself unless it was already set by the caller, since our documentation has
+# always said that this should work.
+sub parse_file {
+ my ($self, $in) = @_;
+ unless (defined $$self{output_fh}) {
+ $self->output_fh (\*STDOUT);
+ }
+ return $self->SUPER::parse_file ($in);
}
##############################################################################
@@ -1321,7 +1373,7 @@ sub parse_from_filehandle {
undef, undef, undef, undef, undef, undef, undef, undef,
undef, undef, undef, undef, undef, undef, undef, undef,
- "A\\*`", "A\\*'", "A\\*^", "A\\*~", "A\\*:", "A\\*o", "\\*(AE", "C\\*,",
+ "A\\*`", "A\\*'", "A\\*^", "A\\*~", "A\\*:", "A\\*o", "\\*(Ae", "C\\*,",
"E\\*`", "E\\*'", "E\\*^", "E\\*:", "I\\*`", "I\\*'", "I\\*^", "I\\*:",
"\\*(D-", "N\\*~", "O\\*`", "O\\*'", "O\\*^", "O\\*~", "O\\*:", undef,
@@ -1382,6 +1434,8 @@ sub preamble_template {
. ds PI \(*p
. ds L" ``
. ds R" ''
+. ds C`
+. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
@@ -1392,18 +1446,26 @@ sub preamble_template {
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
+.\"
+.\" Avoid warning from groff about undefined register 'F'.
+.de IX
..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
+.nr rF 0
+.if \n(.g .if rF .nr rF 1
+.if (\n(rF:(\n(.g==0)) \{
+. if \nF \{
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
..
+. if !\nF==2 \{
+. nr % 0
+. nr F 2
+. \}
+. \}
.\}
+.rr rF
----END OF PREAMBLE----
+#'# for cperl-mode
if ($accents) {
$preamble .= <<'----END OF PREAMBLE----'
@@ -1482,14 +1544,14 @@ sub preamble_template {
1;
__END__
-=head1 NAME
-
-Pod::Man - Convert POD data to formatted *roff input
-
=for stopwords
en em ALLCAPS teeny fixedbold fixeditalic fixedbolditalic stderr utf8
UTF-8 Allbery Sean Burke Ossanna Solaris formatters troff uppercased
-Christiansen
+Christiansen nourls
+
+=head1 NAME
+
+Pod::Man - Convert POD data to formatted *roff input
=head1 SYNOPSIS
@@ -1551,6 +1613,16 @@ argument.
Sets the centered page header to use instead of "User Contributed Perl
Documentation".
+=item errors
+
+How to report errors. C<die> says to throw an exception on any POD
+formatting error. C<stderr> says to report errors on standard error, but
+not to throw an exception. C<pod> says to include a POD ERRORS section
+in the resulting documentation summarizing the errors. C<none> ignores
+POD errors entirely, as much as possible.
+
+The default is C<output>.
+
=item date
Sets the left-hand footer. By default, the modification date of the input
@@ -1591,6 +1663,22 @@ module path. If it is, a path like C<.../lib/Pod/Man.pm> is converted into
a name like C<Pod::Man>. This option, if given, overrides any automatic
determination of the name.
+=item nourls
+
+Normally, LZ<><> formatting codes with a URL but anchor text are formatted
+to show both the anchor text and the URL. In other words:
+
+ L<foo|http://example.com/>
+
+is formatted as:
+
+ foo <http://example.com/>
+
+This option, if set to a true value, suppresses the URL when anchor text
+is given, so this example would be formatted as just C<foo>. This can
+produce less cluttered output in cases where the URLs are not particularly
+important.
+
=item quotes
Sets the quote marks used to surround CE<lt>> text. If the value is a
@@ -1628,7 +1716,9 @@ case section 3 will be selected.
=item stderr
Send error messages about invalid POD to standard error instead of
-appending a POD ERRORS section to the generated *roff output.
+appending a POD ERRORS section to the generated *roff output. This is
+equivalent to setting C<errors> to C<stderr> if C<errors> is not already
+set. It is supported for backward compatibility.
=item utf8
@@ -1675,13 +1765,23 @@ method. See L<Pod::Simple> for the specific details.
(F) You specified a *roff font (using C<fixed>, C<fixedbold>, etc.) that
wasn't either one or two characters. Pod::Man doesn't support *roff fonts
-longer than two characters, although some *roff extensions do (the canonical
-versions of B<nroff> and B<troff> don't either).
+longer than two characters, although some *roff extensions do (the
+canonical versions of B<nroff> and B<troff> don't either).
+
+=item Invalid errors setting "%s"
+
+(F) The C<errors> parameter to the constructor was set to an unknown value.
=item Invalid quote specification "%s"
-(F) The quote specification given (the quotes option to the constructor) was
-invalid. A quote specification must be one, two, or four characters long.
+(F) The quote specification given (the C<quotes> option to the
+constructor) was invalid. A quote specification must be one, two, or four
+characters long.
+
+=item POD document had syntax errors
+
+(F) The POD document being formatted had syntax errors and the C<errors>
+option was set to C<die>.
=back
@@ -1743,8 +1843,8 @@ mine).
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-Russ Allbery <rra@stanford.edu>.
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+2009, 2010, 2012, 2013 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/Master/tlpkg/tlperl/lib/Pod/ParseUtils.pm b/Master/tlpkg/tlperl/lib/Pod/ParseUtils.pm
index 3c74d786801..e41c6e023bc 100644
--- a/Master/tlpkg/tlperl/lib/Pod/ParseUtils.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/ParseUtils.pm
@@ -11,7 +11,7 @@ package Pod::ParseUtils;
use strict;
use vars qw($VERSION);
-$VERSION = '1.51'; ## Current version of this package
+$VERSION = '1.60'; ## Current version of this package
require 5.005; ## requires this Perl version or later
=head1 NAME
diff --git a/Master/tlpkg/tlperl/lib/Pod/Parser.pm b/Master/tlpkg/tlperl/lib/Pod/Parser.pm
index 9a6acd62f18..4f9e20abb11 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Parser.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Parser.pm
@@ -12,7 +12,7 @@ use strict;
## These "variables" are used as local "glob aliases" for performance
use vars qw($VERSION @ISA %myData %myOpts @input_stack);
-$VERSION = '1.51'; ## Current version of this package
+$VERSION = '1.60'; ## Current version of this package
require 5.005; ## requires this Perl version or later
#############################################################################
@@ -90,6 +90,10 @@ B<Pod::Parser> parses PODs, and makes method calls to handle the various
components of the POD. Subclasses of B<Pod::Parser> override these methods
to translate the POD into whatever output format they desire.
+Note: This module is considered as legacy; modern Perl releases (5.18 and
+higher) are going to remove Pod::Parser from core and use L<Pod::Simple>
+for all things POD.
+
=head1 QUICK OVERVIEW
To create a POD filter for translating POD documentation into some other
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc.pm
index a0dd24addc2..8c841e833e8 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc.pm
@@ -12,7 +12,7 @@ use File::Spec::Functions qw(catfile catdir splitdir);
use vars qw($VERSION @Pagers $Bindir $Pod2man
$Temp_Files_Created $Temp_File_Lifetime
);
-$VERSION = '3.17';
+$VERSION = '3.19';
#..........................................................................
@@ -798,7 +798,7 @@ sub options_sanity {
if( $self->opt_f or $self->opt_q ) {
$self->usage("Only one of -f -or -q") if $self->opt_f and $self->opt_q;
$self->warn(
- "Perldoc is only really meant for reading one word at a time.\n",
+ "Perldoc is meant for reading one file at a time.\n",
"So these parameters are being ignored: ",
join(' ', @{$self->{'args'}}),
"\n" )
@@ -1423,7 +1423,7 @@ sub minus_f_nocase { # i.e., do like -f, but without regard to case
if(!$self->opt_i
or $self->is_vms or $self->is_mswin32
- or $self->Is_dos or $self->is_os2
+ or $self->is_dos or $self->is_os2
) {
# On a case-forgiving file system, or if case is important,
# that is it, all we can do.
@@ -1514,7 +1514,7 @@ sub pagers_guessing {
}
}
- unshift @pagers, $ENV{PERLDOC_PAGER} if $ENV{PERLDOC_PAGER};
+ unshift @pagers, "$ENV{PERLDOC_PAGER} <" if $ENV{PERLDOC_PAGER};
return;
}
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm
index aa8d84493ff..5bf8a936a78 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
use Carp qw(croak carp);
use Config qw(%Config);
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm
index c77d5460483..0355f8f3ca2 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm
@@ -2,7 +2,7 @@ package Pod::Perldoc::GetOptsOO;
use strict;
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
BEGIN { # Make a DEBUG constant ASAP
*DEBUG = defined( &Pod::Perldoc::DEBUG )
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm
index 7be62e23589..c6534bd4cf6 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm
@@ -4,7 +4,7 @@ use warnings;
use parent qw(Pod::Perldoc::BaseTo);
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
sub is_pageable { 1 }
sub write_with_binmode { 0 }
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm
index 32c309bd445..6f8d12c1120 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm
@@ -4,7 +4,7 @@ use warnings;
use vars qw(@ISA);
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
# Pick our superclass...
#
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm
index 55616e8b899..225a78618d5 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm
@@ -5,7 +5,7 @@ use warnings;
use parent qw(Pod::Perldoc::BaseTo);
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
use File::Spec::Functions qw(catfile);
use Pod::Man 2.18;
@@ -138,7 +138,14 @@ sub _get_podman_switches {
my @switches = grep !m/^_/s, keys %$self;
- push @switches, 'utf8' => 1;
+ # There needs to be a cleaner way to handle setting
+ # the UTF-8 flag, but for now, comment out this
+ # line because it often does the wrong thing.
+ #
+ # See RT #77465
+ #
+ #push @switches, 'utf8' => 1;
+
$self->debug( "Pod::Man switches are [@switches]\n" );
return @switches;
@@ -298,7 +305,7 @@ sub _filter_through_nroff {
# Maybe someone set rendering switches as part of the opt_n value
# Deal with that here.
- my ($render, $switches) = $self->__nroffer() =~ /\A([\/a-zA-Z0-9_-]+)\b(.+)?\z/;
+ my ($render, $switches) = $self->__nroffer() =~ /\A([\/a-zA-Z0-9_\.-]+)\b(.+)?\z/;
$self->die("no nroffer!?") unless $render;
my @render_switches = $self->_collect_nroff_switches;
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm
index 2e92f2a134e..4f720e7f0e6 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm
@@ -4,7 +4,7 @@ use warnings;
use parent qw(Pod::Perldoc::BaseTo);
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
# This is unlike ToMan.pm in that it emits the raw nroff source!
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm
index 6c15c02a781..7083ae67b36 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm
@@ -4,7 +4,7 @@ use warnings;
use parent qw(Pod::Perldoc::BaseTo);
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
sub is_pageable { 1 }
sub write_with_binmode { 0 }
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm
index a7d4739a6f0..6e190f73a27 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm
@@ -4,7 +4,7 @@ use warnings;
use parent qw( Pod::Simple::RTF );
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
sub is_pageable { 0 }
sub write_with_binmode { 0 }
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm
index dddc4c8fce7..f8d9349d10a 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
use parent qw(Pod::Perldoc::BaseTo);
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm
index 0e4e2dacf4d..530bdee7ad0 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
use parent qw(Pod::Perldoc::BaseTo);
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm
index fb8da15c245..deed6b3ff15 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
use parent qw(Pod::Perldoc::BaseTo);
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm
index 96f35c4f4b7..f85f01eb7bd 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm
@@ -6,7 +6,7 @@ use vars qw($VERSION);
use parent qw( Pod::Simple::XMLOutStream );
use vars qw($VERSION);
-$VERSION = '3.17';
+$VERSION = '3.19';
sub is_pageable { 0 }
sub write_with_binmode { 0 }
diff --git a/Master/tlpkg/tlperl/lib/Pod/PlainText.pm b/Master/tlpkg/tlperl/lib/Pod/PlainText.pm
index 06df184097f..81fee052903 100644
--- a/Master/tlpkg/tlperl/lib/Pod/PlainText.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/PlainText.pm
@@ -29,7 +29,7 @@ use vars qw(@ISA %ESCAPES $VERSION);
# by Pod::Usage.
@ISA = qw(Pod::Select);
-$VERSION = '2.05';
+$VERSION = '2.06';
BEGIN {
if ($] < 5.006) {
@@ -394,6 +394,10 @@ sub cmd_for {
$self->verbatim ($_, $line);
}
+# just a dummy method for the time being
+sub cmd_encoding {
+ return;
+}
############################################################################
# Interior sequences
diff --git a/Master/tlpkg/tlperl/lib/Pod/Select.pm b/Master/tlpkg/tlperl/lib/Pod/Select.pm
index 300eee537e8..f822d211b65 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Select.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Select.pm
@@ -11,7 +11,7 @@ package Pod::Select;
use strict;
use vars qw($VERSION @ISA @EXPORT $MAX_HEADING_LEVEL %myData @section_headings @selected_sections);
-$VERSION = '1.51'; ## Current version of this package
+$VERSION = '1.60'; ## Current version of this package
require 5.005; ## requires this Perl version or later
#############################################################################
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple.pm b/Master/tlpkg/tlperl/lib/Pod/Simple.pm
index ad7a19b8eff..fb5438f7f71 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple.pm
@@ -18,7 +18,7 @@ use vars qw(
);
@ISA = ('Pod::Simple::BlackBox');
-$VERSION = '3.20';
+$VERSION = '3.28';
@Known_formatting_codes = qw(I B C L E F S X Z);
%Known_formatting_codes = map(($_=>1), @Known_formatting_codes);
@@ -80,6 +80,7 @@ __PACKAGE__->_accessorize(
'bare_output', # For some subclasses: whether to prepend
# header-code and postpend footer-code
+ 'keep_encoding_directive', # whether to emit =encoding
'nix_X_codes', # whether to ignore X<...> codes
'merge_text', # whether to avoid breaking a single piece of
# text up into several events
@@ -87,6 +88,8 @@ __PACKAGE__->_accessorize(
'preserve_whitespace', # whether to try to keep whitespace as-is
'strip_verbatim_indent', # What indent to strip from verbatim
+ 'parse_characters', # Whether parser should expect chars rather than octets
+
'content_seen', # whether we've seen any real Pod content
'errors_seen', # TODO: document. whether we've seen any errors (fatal or not)
@@ -111,6 +114,35 @@ sub any_errata_seen { # good for using as an exit() value...
return shift->{'errors_seen'} || 0;
}
+# Returns the encoding only if it was recognized as being handled and set
+sub detected_encoding {
+ return shift->{'detected_encoding'};
+}
+
+sub encoding {
+ my $this = shift;
+ return $this->{'encoding'} unless @_; # GET.
+
+ $this->_handle_encoding_line("=encoding $_[0]");
+ if ($this->{'_processed_encoding'}) {
+ delete $this->{'_processed_encoding'};
+ if(! $this->{'encoding_command_statuses'} ) {
+ DEBUG > 2 and print " CRAZY ERROR: encoding wasn't really handled?!\n";
+ } elsif( $this->{'encoding_command_statuses'}[-1] ) {
+ $this->scream( "=encoding $_[0]",
+ sprintf "Couldn't do %s: %s",
+ $this->{'encoding_command_reqs' }[-1],
+ $this->{'encoding_command_statuses'}[-1],
+ );
+ } else {
+ DEBUG > 2 and print " (encoding successfully handled.)\n";
+ }
+ return $this->{'encoding'};
+ } else {
+ return undef;
+ }
+}
+
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# Pull in some functions that, for some reason, I expect to see here too:
BEGIN {
@@ -1033,6 +1065,12 @@ sub _treat_Ls { # Process our dear dear friends, the L<...> sequences
$treelet->[$i] = 'L<>'; # just make it a text node
next; # and move on
}
+
+ if( (! ref $ell->[2] && $ell->[2] =~ /\A\s/)
+ ||(! ref $ell->[-1] && $ell->[-1] =~ /\s\z/)
+ ) {
+ $self->whine( $start_line, "L<> starts or ends with whitespace" );
+ }
# Catch URLs:
@@ -1092,7 +1130,7 @@ sub _treat_Ls { # Process our dear dear friends, the L<...> sequences
# Catch some very simple and/or common cases
if(@{$ell} == 3 and ! ref $ell->[2]) {
my $it = $ell->[2];
- if($it =~ m/^[-a-zA-Z0-9]+\([-a-zA-Z0-9]+\)$/s) { # man sections
+ if($it =~ m{^[^/|]+[(][-a-zA-Z0-9]+[)]$}s) { # man sections
# Hopefully neither too broad nor too restrictive a RE
DEBUG > 1 and print "Catching \"$it\" as manpage link.\n";
$ell->[1]{'type'} = 'man';
@@ -1148,6 +1186,13 @@ sub _treat_Ls { # Process our dear dear friends, the L<...> sequences
DEBUG > 3 and
print " FOUND a '|' in it. Splitting into [$1] + [$2]\n";
+ if ($link_text[0] =~ m{[|/]}) {
+ $self->whine(
+ $start_line,
+ "alternative text '$link_text[0]' contains non-escaped | or /"
+ );
+ }
+
unshift @link_text, splice @ell_content, 0, $j;
# leaving only things at J and after
@ell_content = grep ref($_)||length($_), @ell_content ;
@@ -1251,7 +1296,7 @@ sub _treat_Ls { # Process our dear dear friends, the L<...> sequences
# And the E resolver will have to deal with all our treeletty things:
if(@ell_content == 1 and !ref($ell_content[0])
- and $ell_content[0] =~ m/^[-a-zA-Z0-9]+\([-a-zA-Z0-9]+\)$/s
+ and $ell_content[0] =~ m{^[^/]+[(][-a-zA-Z0-9]+[)]$}s
) {
$ell->[1]{'type'} = 'man';
DEBUG > 3 and print "Considering this ($ell_content[0]) a man link.\n";
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm
index c17cfd0ad51..a1b570810d0 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm
@@ -23,7 +23,7 @@ use integer; # vroom!
use strict;
use Carp ();
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
#use constant DEBUG => 7;
BEGIN {
require Pod::Simple;
@@ -91,6 +91,7 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines)
if( ($line = $source_line) =~ s/^\xEF\xBB\xBF//s ) {
DEBUG and print "UTF-8 BOM seen. Faking a '=encoding utf8'.\n";
$self->_handle_encoding_line( "=encoding utf8" );
+ delete $self->{'_processed_encoding'};
$line =~ tr/\n\r//d;
} elsif( $line =~ s/^\xFE\xFF//s ) {
@@ -123,6 +124,22 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines)
}
}
+ # Try to guess encoding. Inlined for performance reasons.
+ if(!$self->{'parse_characters'} && !$self->{'encoding'}
+ && ($self->{'in_pod'} || $line =~ /^=/s)
+ && $line =~ /[^\x00-\x7f]/
+ ) {
+ my $encoding = $line =~ /^[\x00-\x7f]*[\xC0-\xFD][\x80-\xBF]/ ? 'UTF-8' : 'ISO8859-1';
+ $self->_handle_encoding_line( "=encoding $encoding" );
+ $self->{'_transcoder'} && $self->{'_transcoder'}->($line);
+
+ my ($word) = $line =~ /(\S*[^\x00-\x7f]\S*)/;
+
+ $self->whine(
+ $self->{'line_count'},
+ "Non-ASCII character seen before =encoding in '$word'. Assuming $encoding"
+ );
+ }
DEBUG > 5 and print "# Parsing line: [$line]\n";
@@ -176,6 +193,7 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines)
# HERE WE CATCH =encoding EARLY!
if( $line =~ m/^=encoding\s+\S+\s*$/s ) {
+ next if $self->parse_characters; # Ignore this line
$line = $self->_handle_encoding_line( $line );
}
@@ -269,6 +287,8 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines)
sub _handle_encoding_line {
my($self, $line) = @_;
+ return if $self->parse_characters;
+
# The point of this routine is to set $self->{'_transcoder'} as indicated.
return $line unless $line =~ m/^=encoding\s+(\S+)\s*$/s;
@@ -324,6 +344,7 @@ sub _handle_encoding_line {
$@ && die( $enc_error =
"Really unexpected error setting up encoding $e: $@\nAborting"
);
+ $self->{'detected_encoding'} = $e;
} else {
my @supported = Pod::Simple::Transcode::->all_encodings;
@@ -354,8 +375,13 @@ sub _handle_encoding_line {
$self->scream( $self->{'line_count'}, $enc_error );
}
push @{ $self->{'encoding_command_statuses'} }, $enc_error;
+ if (defined($self->{'_processed_encoding'})) {
+ # Should never happen
+ die "Nested processed encoding.";
+ }
+ $self->{'_processed_encoding'} = $orig;
- return '=encoding ALREADYDONE';
+ return $line;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -371,7 +397,11 @@ sub _handle_encoding_second_level {
DEBUG > 2 and print "Ogling encoding directive: =encoding $content\n";
- if($content eq 'ALREADYDONE') {
+ if (defined($self->{'_processed_encoding'})) {
+ #if($content ne $self->{'_processed_encoding'}) {
+ # Could it happen?
+ #}
+ delete $self->{'_processed_encoding'};
# It's already been handled. Check for errors.
if(! $self->{'encoding_command_statuses'} ) {
DEBUG > 2 and print " CRAZY ERROR: It wasn't really handled?!\n";
@@ -642,8 +672,10 @@ sub _ponder_paragraph_buffer {
if($item_type eq 'text') {
# Nothing special needs doing for 'text'
} elsif($item_type eq 'number' or $item_type eq 'bullet') {
- die "Unknown item type $item_type"
- unless $item_type eq 'number' or $item_type eq 'bullet';
+ $self->whine(
+ $para->[1]{'start_line'},
+ "Expected text after =item, not a $item_type"
+ );
# Undo our clobbering:
push @$para, $para->[1]{'~orig_content'};
delete $para->[1]{'number'};
@@ -772,8 +804,8 @@ sub _ponder_paragraph_buffer {
} elsif($para_type eq '=encoding') {
# Not actually acted on here, but we catch errors here.
$self->_handle_encoding_second_level($para);
-
- next; # and skip
+ next unless $self->keep_encoding_directive;
+ $para_type = 'Plain';
} elsif($para_type eq '~Verbatim') {
$para->[0] = 'Verbatim';
$para_type = '?Verbatim';
@@ -1250,8 +1282,10 @@ sub _ponder_item {
if($item_type eq 'text') {
# Nothing special needs doing for 'text'
} elsif($item_type eq 'number' or $item_type eq 'bullet') {
- die "Unknown item type $item_type"
- unless $item_type eq 'number' or $item_type eq 'bullet';
+ $self->whine(
+ $para->[1]{'start_line'},
+ "Expected text after =item, not a $item_type"
+ );
# Undo our clobbering:
push @$para, $para->[1]{'~orig_content'};
delete $para->[1]{'number'};
@@ -1459,10 +1493,12 @@ sub _traverse_treelet_bit { # for use only by the routine above
my $scratch;
$self->_handle_element_start(($scratch=$name), shift @_);
- foreach my $x (@_) {
- if(ref($x)) {
+ while (@_) {
+ my $x = shift;
+ if (ref($x)) {
&_traverse_treelet_bit($self, @$x);
} else {
+ $x .= shift while @_ && !ref($_[0]);
$self->_handle_text($x);
}
}
@@ -1483,6 +1519,11 @@ sub _closers_for_all_curr_open {
if($copy[0] eq '=for') {
$copy[0] = '=end';
} elsif($copy[0] eq '=over') {
+ $self->whine(
+ $still_open->[1]{start_line} ,
+ "=over without closing =back"
+ );
+
$copy[0] = '=back';
} else {
die "I don't know how to auto-close an open $copy[0] region";
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm
index c97267a86ba..92e1bee238a 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm
@@ -9,7 +9,7 @@ use Carp ();
use Pod::Simple::Methody ();
use Pod::Simple ();
use vars qw( @ISA $VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
@ISA = ('Pod::Simple::Methody');
BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG)
? \&Pod::Simple::DEBUG
@@ -159,7 +159,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm
index 57733028427..b170bb780ab 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm
@@ -3,7 +3,7 @@ require 5;
package Pod::Simple::Debug;
use strict;
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
sub import {
my($value,$variable);
@@ -141,7 +141,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm
index 5e2d7ebf5ff..019dfd57fbd 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm
@@ -1,7 +1,7 @@
require 5;
package Pod::Simple::DumpAsText;
-$VERSION = '3.20';
+$VERSION = '3.28';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
@@ -16,6 +16,7 @@ sub new {
my $new = $self->SUPER::new(@_);
$new->{'output_fh'} ||= *STDOUT{IO};
$new->accept_codes('VerbatimFormatted');
+ $new->keep_encoding_directive(1);
return $new;
}
@@ -118,7 +119,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm
index e43422bbd7c..ac925c08eff 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm
@@ -1,13 +1,14 @@
require 5;
package Pod::Simple::DumpAsXML;
-$VERSION = '3.20';
+$VERSION = '3.28';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
use strict;
use Carp ();
+use Text::Wrap qw(wrap);
BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG }
@@ -16,6 +17,7 @@ sub new {
my $new = $self->SUPER::new(@_);
$new->{'output_fh'} ||= *STDOUT{IO};
$new->accept_codes('VerbatimFormatted');
+ $new->keep_encoding_directive(1);
return $new;
}
@@ -49,15 +51,8 @@ sub _handle_text {
my $indent = ' ' x $_[0]{'indent'};
my $text = $_[1];
_xml_escape($text);
- $text =~ # A not-totally-brilliant wrapping algorithm:
- s/(
- [^\n]{55} # Snare some characters from a line
- [^\n\ ]{0,50} # and finish any current word
- )
- \x20{1,10}(?!\n) # capture some spaces not at line-end
- /$1\n$indent/gx # => line-break here
- ;
-
+ local $Text::Wrap::huge = 'overflow';
+ $text = wrap('', $indent, $text);
print {$_[0]{'output_fh'}} $indent, $text, "\n";
}
return;
@@ -133,7 +128,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm
index 12fad403589..8a2f81569c1 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm
@@ -10,7 +10,7 @@ use vars qw(
$Doctype_decl $Content_decl
);
@ISA = ('Pod::Simple::PullParser');
-$VERSION = '3.20';
+$VERSION = '3.28';
BEGIN {
if(defined &DEBUG) { } # no-op
@@ -134,7 +134,7 @@ my @_to_accept;
qw[
sample=samp
definition=dfn
- kbd=keyboard
+ keyboard=kbd
variable=var
citation=cite
abbreviation=abbr
@@ -145,6 +145,8 @@ my @_to_accept;
small=small
underline=u
strikethrough=s
+ preformat=pre
+ teletype=tt
] # no point in providing a way to get <q>...</q>, I think
),
@@ -1089,7 +1091,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm
index 52e77bcc1b8..e41b11e2c50 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm
@@ -5,7 +5,7 @@ use strict;
use vars qw( $VERSION $HTML_RENDER_CLASS $HTML_EXTENSION
$CSS $JAVASCRIPT $SLEEPY $SEARCH_CLASS @ISA
);
-$VERSION = '3.20';
+$VERSION = '3.28';
@ISA = (); # Yup, we're NOT a subclass of Pod::Simple::HTML!
# TODO: nocontents stylesheets. Strike some of the color variations?
@@ -1093,7 +1093,7 @@ Example:
% mkdir ../seekrut
% chmod og-rx ../seekrut
- % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go . ../htmlversion
+ % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go . ../seekrut
(to convert the pod under the current dir into HTML
files under the directory ./seekrut)
@@ -1333,7 +1333,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm
index 5aa5bc19897..be1f5345d08 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm
@@ -3,12 +3,12 @@ require 5;
package Pod::Simple::LinkSection;
# Based somewhat dimly on Array::Autojoin
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
use strict;
use Pod::Simple::BlackBox;
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
use overload( # So it'll stringify nice
'""' => \&Pod::Simple::BlackBox::stringify_lol,
@@ -137,7 +137,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm
index 4113daf2351..38acaa20d0b 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm
@@ -4,7 +4,7 @@ package Pod::Simple::Methody;
use strict;
use Pod::Simple ();
use vars qw(@ISA $VERSION);
-$VERSION = '3.20';
+$VERSION = '3.28';
@ISA = ('Pod::Simple');
# Yes, we could use named variables, but I want this to be impose
@@ -115,7 +115,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm
index e85084a1c26..f9cd6816722 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm
@@ -1,7 +1,7 @@
require 5;
package Pod::Simple::Progress;
-$VERSION = '3.20';
+$VERSION = '3.28';
use strict;
# Objects of this class are used for noting progress of an
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParser.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParser.pm
index c9726fd564a..5c13724dc11 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParser.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParser.pm
@@ -1,7 +1,7 @@
require 5;
package Pod::Simple::PullParser;
-$VERSION = '3.20';
+$VERSION = '3.28';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
@@ -347,6 +347,7 @@ sub _get_titled_section {
my $head1_text_content;
my $para_text_content;
+ my $skipX;
while(
++$token_count <= ($max_token || 1_000_000)
@@ -364,8 +365,14 @@ sub _get_titled_section {
elsif($state == 1) { # accumulating text until end of head1
if( $token->is_text ) {
- DEBUG and print " Adding \"", $token->text, "\" to head1-content.\n";
- $head1_text_content .= $token->text;
+ unless ($skipX) {
+ DEBUG and print " Adding \"", $token->text, "\" to head1-content.\n";
+ $head1_text_content .= $token->text;
+ }
+ } elsif( $token->is_tagname('X') ) {
+ # We're going to want to ignore X<> stuff.
+ $skipX = $token->is_start;
+ DEBUG and print +($skipX ? 'Start' : 'End'), 'ing ignoring of X<> tag';
} elsif( $token->is_end and $token->tagname eq 'head1' ) {
DEBUG and print " Found end of head1. Considering content...\n";
$head1_text_content = uc $head1_text_content if $nocase;
@@ -392,9 +399,9 @@ sub _get_titled_section {
? (length($head1_text_content) <= $max_content_length) # sanity
: 1)
) {
- DEBUG and print " It looks titular: \"$head1_text_content\".\n",
- "\n Using that.\n";
- $title = $head1_text_content;
+ # Looks good; trim it
+ ($title = $head1_text_content) =~ s/\s+$//;
+ DEBUG and print " It looks titular: \"$title\".\n\n Using that.\n";
last;
} else {
--$state;
@@ -736,7 +743,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm
index a45aba18bae..5fa402318eb 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm
@@ -5,7 +5,7 @@ use Pod::Simple::PullParserToken ();
use strict;
use vars qw(@ISA $VERSION);
@ISA = ('Pod::Simple::PullParserToken');
-$VERSION = '3.20';
+$VERSION = '3.28';
sub new { # Class->new(tagname);
my $class = shift;
@@ -83,7 +83,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm
index e9fbaa2b5ec..3edb0ad5695 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm
@@ -5,7 +5,7 @@ use Pod::Simple::PullParserToken ();
use strict;
use vars qw(@ISA $VERSION);
@ISA = ('Pod::Simple::PullParserToken');
-$VERSION = '3.20';
+$VERSION = '3.28';
sub new { # Class->new(tagname, optional_attrhash);
my $class = shift;
@@ -124,7 +124,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm
index 34985fdfb03..a75fd7a706e 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm
@@ -5,7 +5,7 @@ use Pod::Simple::PullParserToken ();
use strict;
use vars qw(@ISA $VERSION);
@ISA = ('Pod::Simple::PullParserToken');
-$VERSION = '3.20';
+$VERSION = '3.28';
sub new { # Class->new(text);
my $class = shift;
@@ -91,7 +91,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm
index b323ece2a32..bbae51ba69e 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm
@@ -3,7 +3,7 @@ require 5;
package Pod::Simple::PullParserToken;
# Base class for tokens gotten from Pod::Simple::PullParser's $parser->get_token
@ISA = ();
-$VERSION = '3.20';
+$VERSION = '3.28';
use strict;
sub new { # Class->new('type', stuff...); ## Overridden in derived classes anyway
@@ -126,7 +126,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm
index 0d184e3a66b..067e6b9dd35 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm
@@ -8,7 +8,7 @@ package Pod::Simple::RTF;
use strict;
use vars qw($VERSION @ISA %Escape $WRAP %Tagmap);
-$VERSION = '3.20';
+$VERSION = '3.28';
use Pod::Simple::PullParser ();
BEGIN {@ISA = ('Pod::Simple::PullParser')}
@@ -662,7 +662,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm
index 7e507e62b95..15cb292fc50 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm
@@ -4,7 +4,7 @@ package Pod::Simple::Search;
use strict;
use vars qw($VERSION $MAX_VERSION_WITHIN $SLEEPY);
-$VERSION = '3.20'; ## Current version of this package
+$VERSION = '3.28'; ## Current version of this package
BEGIN { *DEBUG = sub () {0} unless defined &DEBUG; } # set DEBUG level
use Carp ();
@@ -1011,7 +1011,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm
index 3671af121f0..0b42a22b273 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm
@@ -6,7 +6,7 @@ use strict;
use Carp ();
use Pod::Simple ();
use vars qw( $ATTR_PAD @ISA $VERSION $SORT_ATTRS);
-$VERSION = '3.20';
+$VERSION = '3.28';
BEGIN {
@ISA = ('Pod::Simple');
*DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG;
@@ -143,7 +143,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm
index 3032d0fcd57..bd1a5416df8 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm
@@ -6,7 +6,7 @@ use Carp ();
use Pod::Simple::Methody ();
use Pod::Simple ();
use vars qw( @ISA $VERSION $FREAKYMODE);
-$VERSION = '3.20';
+$VERSION = '3.28';
@ISA = ('Pod::Simple::Methody');
BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG)
? \&Pod::Simple::DEBUG
@@ -148,7 +148,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm
index dea1cde7ccf..6788df6d762 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm
@@ -6,7 +6,7 @@ use strict;
use Carp ();
use Pod::Simple ();
use vars qw( @ISA $VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
@ISA = ('Pod::Simple');
sub new {
@@ -75,7 +75,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/TiedOutFH.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/TiedOutFH.pm
index 9f2a224a278..0b2fb2f8c49 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/TiedOutFH.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/TiedOutFH.pm
@@ -4,7 +4,7 @@ package Pod::Simple::TiedOutFH;
use Symbol ('gensym');
use Carp ();
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Transcode.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Transcode.pm
index 892436db7f0..9e835048a0e 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Transcode.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Transcode.pm
@@ -2,7 +2,7 @@
require 5;
package Pod::Simple::Transcode;
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
BEGIN {
if(defined &DEBUG) {;} # Okay
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeDumb.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeDumb.pm
index 33030903430..4749e9af198 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeDumb.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeDumb.pm
@@ -5,7 +5,7 @@ require 5;
package Pod::Simple::TranscodeDumb;
use strict;
use vars qw($VERSION %Supported);
-$VERSION = '3.20';
+$VERSION = '3.28';
# This module basically pretends it knows how to transcode, except
# only for null-transcodings! We use this when Encode isn't
# available.
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeSmart.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeSmart.pm
index a66dedd03bc..06fdb9f2750 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeSmart.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/TranscodeSmart.pm
@@ -9,7 +9,7 @@ use strict;
use Pod::Simple;
require Encode;
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.28';
sub is_dumb {0}
sub is_smart {1}
@@ -27,12 +27,12 @@ sub encmodver {
}
sub make_transcoder {
- my($e) = $_[1];
+ my $e = Encode::find_encoding($_[1]);
die "WHAT ENCODING!?!?" unless $e;
my $x;
return sub {
foreach $x (@_) {
- $x = Encode::decode($e, $x);
+ $x = $e->decode($x) unless Encode::is_utf8($x);
}
return;
};
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm
index 9d31db0badd..df896e64a7c 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm
@@ -45,7 +45,7 @@ declare the output character set as UTF-8 before parsing, like so:
package Pod::Simple::XHTML;
use strict;
use vars qw( $VERSION @ISA $HAS_HTML_ENTITIES );
-$VERSION = '3.20';
+$VERSION = '3.28';
use Pod::Simple::Methody ();
@ISA = ('Pod::Simple::Methody');
@@ -151,7 +151,7 @@ Add additional meta tags here, or blocks of inline CSS or JavaScript
A string containing all characters that should be encoded as HTML entities,
specified using the regular expression character class syntax (what you find
within brackets in regular expressions). This value will be passed as the
-second argument to the C<encode_entities> fuction of L<HTML::Entities>. IF
+second argument to the C<encode_entities> function of L<HTML::Entities>. If
L<HTML::Entities> is not installed, then any characters other than C<&<>"'>
will be encoded numerically.
@@ -251,7 +251,6 @@ sub new {
$new->man_url_prefix('http://man.he.net/man');
$new->html_charset('ISO-8859-1');
$new->nix_X_codes(1);
- $new->codes_in_verbatim(1);
$new->{'scratch'} = '';
$new->{'to_index'} = [];
$new->{'output'} = [];
@@ -301,11 +300,27 @@ something like:
my ($self, $text) = @_;
if ($self->{'in_foo'}) {
$self->{'scratch'} .= build_foo_html($text);
- } else {
- $self->{'scratch'} .= $text;
+ return;
}
+ $self->SUPER::handle_text($text);
}
+=head2 handle_code
+
+This method handles the body of text that is marked up to be code.
+You might for instance override this to plug in a syntax highlighter.
+The base implementation just escapes the text.
+
+The callback methods C<start_code> and C<end_code> emits the C<code> tags
+before and after C<handle_code> is invoked, so you might want to override these
+together with C<handle_code> if this wrapping isn't suiteable.
+
+Note that the code might be broken into mulitple segments if there are
+nested formatting codes inside a C<< CE<lt>...> >> sequence. In between the
+calls to C<handle_code> other markup tags might have been emitted in that
+case. The same is true for verbatim sections if the C<codes_in_verbatim>
+option is turned on.
+
=head2 accept_targets_as_html
This method behaves like C<accept_targets_as_text>, but also marks the region
@@ -328,18 +343,47 @@ sub accept_targets_as_html {
sub handle_text {
# escape special characters in HTML (<, >, &, etc)
- $_[0]{'scratch'} .= $_[0]->__in_literal_xhtml_region
- ? $_[1]
- : $_[0]->encode_entities( $_[1] );
+ my $text = $_[0]->__in_literal_xhtml_region
+ ? $_[1]
+ : $_[0]->encode_entities( $_[1] );
+
+ if ($_[0]{'in_code'} && @{$_[0]{'in_code'}}) {
+ # Intentionally use the raw text in $_[1], even if we're not in a
+ # literal xhtml region, since handle_code calls encode_entities.
+ $_[0]->handle_code( $_[1], $_[0]{'in_code'}[-1] );
+ } else {
+ $_[0]{'scratch'} .= $text;
+ }
+
+ $_[0]{htext} .= $text if $_[0]{'in_head'};
}
-sub start_Para { $_[0]{'scratch'} = '<p>' }
-sub start_Verbatim { $_[0]{'scratch'} = '<pre><code>' }
+sub start_code {
+ $_[0]{'scratch'} .= '<code>';
+}
-sub start_head1 { $_[0]{'in_head'} = 1 }
-sub start_head2 { $_[0]{'in_head'} = 2 }
-sub start_head3 { $_[0]{'in_head'} = 3 }
-sub start_head4 { $_[0]{'in_head'} = 4 }
+sub end_code {
+ $_[0]{'scratch'} .= '</code>';
+}
+
+sub handle_code {
+ $_[0]{'scratch'} .= $_[0]->encode_entities( $_[1] );
+}
+
+sub start_Para {
+ $_[0]{'scratch'} = '<p>';
+}
+
+sub start_Verbatim {
+ $_[0]{'scratch'} = '<pre>';
+ push(@{$_[0]{'in_code'}}, 'Verbatim');
+ $_[0]->start_code($_[0]{'in_code'}[-1]);
+}
+
+sub start_head1 { $_[0]{'in_head'} = 1; $_[0]{htext} = ''; }
+sub start_head2 { $_[0]{'in_head'} = 2; $_[0]{htext} = ''; }
+sub start_head3 { $_[0]{'in_head'} = 3; $_[0]{htext} = ''; }
+sub start_head4 { $_[0]{'in_head'} = 4; $_[0]{htext} = ''; }
sub start_item_number {
$_[0]{'scratch'} = "</li>\n" if ($_[0]{'in_li'}->[-1] && pop @{$_[0]{'in_li'}});
@@ -397,7 +441,8 @@ sub end_over_text {
sub end_Para { $_[0]{'scratch'} .= '</p>'; $_[0]->emit }
sub end_Verbatim {
- $_[0]{'scratch'} .= '</code></pre>';
+ $_[0]->end_code(pop(@{$_[0]->{'in_code'}}));
+ $_[0]{'scratch'} .= '</pre>';
$_[0]->emit;
}
@@ -408,14 +453,14 @@ sub _end_head {
$add = 1 unless defined $add;
$h += $add - 1;
- my $id = $_[0]->idify($_[0]{scratch});
+ my $id = $_[0]->idify($_[0]{htext});
my $text = $_[0]{scratch};
- $_[0]{'scratch'} = $_[0]->backlink && ($h - $add == 0)
+ $_[0]{'scratch'} = $_[0]->backlink && ($h - $add == 0)
# backlinks enabled && =head1
? qq{<a href="#_podtop_"><h$h id="$id">$text</h$h></a>}
: qq{<h$h id="$id">$text</h$h>};
$_[0]->emit;
- push @{ $_[0]{'to_index'} }, [$h, $id, $text];
+ push @{ $_[0]{'to_index'} }, [$h, $id, delete $_[0]{'htext'}];
}
sub end_head1 { shift->_end_head(@_); }
@@ -568,8 +613,8 @@ sub end_Document {
sub start_B { $_[0]{'scratch'} .= '<b>' }
sub end_B { $_[0]{'scratch'} .= '</b>' }
-sub start_C { $_[0]{'scratch'} .= '<code>' }
-sub end_C { $_[0]{'scratch'} .= '</code>' }
+sub start_C { push(@{$_[0]{'in_code'}}, 'C'); $_[0]->start_code($_[0]{'in_code'}[-1]); }
+sub end_C { $_[0]->end_code(pop(@{$_[0]{'in_code'}})); }
sub start_F { $_[0]{'scratch'} .= '<i>' }
sub end_F { $_[0]{'scratch'} .= '</i>' }
@@ -692,6 +737,11 @@ underscores (_), colons (:), and periods (.).
=item *
+The final character can't be a hyphen, colon, or period. URLs ending with these
+characters, while allowed by XHTML, can be awkward to extract from plain text.
+
+=item *
+
Each id must be unique within the document.
=back
@@ -713,6 +763,7 @@ sub idify {
s/^([^a-zA-Z]+)$/pod$1/; # Prepend "pod" if no valid chars.
s/^[^a-zA-Z]+//; # First char must be a letter.
s/[^-a-zA-Z0-9_:.]+/-/g; # All other chars must be valid.
+ s/[-:.]+$//; # Strip trailing punctuation.
}
return $t if $not_unique;
my $i = '';
@@ -757,7 +808,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm
index bbb815a5527..47496e2577f 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm
@@ -5,7 +5,7 @@ use strict;
use Carp ();
use Pod::Simple ();
use vars qw( $ATTR_PAD @ISA $VERSION $SORT_ATTRS);
-$VERSION = '3.20';
+$VERSION = '3.28';
BEGIN {
@ISA = ('Pod::Simple');
*DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG;
@@ -20,6 +20,7 @@ sub new {
my $self = shift;
my $new = $self->SUPER::new(@_);
$new->{'output_fh'} ||= *STDOUT{IO};
+ $new->keep_encoding_directive(1);
#$new->accept_codes('VerbatimFormatted');
return $new;
}
@@ -148,7 +149,7 @@ pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
-L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
+L<https://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
to clone L<git://github.com/theory/pod-simple.git> and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
diff --git a/Master/tlpkg/tlperl/lib/Pod/Text.pm b/Master/tlpkg/tlperl/lib/Pod/Text.pm
index cc028206606..f57256f2d93 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Text.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Text.pm
@@ -1,11 +1,5 @@
# Pod::Text -- Convert POD data to formatted ASCII text.
#
-# Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009
-# 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.
-#
# This module converts POD to formatted text. It replaces the old Pod::Text
# module that came with versions of Perl prior to 5.6.0 and attempts to match
# its output except for some specific circumstances where other decisions
@@ -16,6 +10,12 @@
# maintained outside of the Perl core as part of the podlators. Please send
# me any patches at the address above in addition to sending them to the
# standard Perl mailing lists.
+#
+# Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009, 2012, 2013
+# 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.
##############################################################################
# Modules and declarations
@@ -38,7 +38,7 @@ use Pod::Simple ();
# We have to export pod2text for backward compatibility.
@EXPORT = qw(pod2text);
-$VERSION = '3.15';
+$VERSION = '3.17';
##############################################################################
# Initialization
@@ -87,11 +87,30 @@ sub new {
%$self = (%$self, @opts);
# Send errors to stderr if requested.
- if ($$self{opt_stderr}) {
+ if ($$self{opt_stderr} and not $$self{opt_errors}) {
+ $$self{opt_errors} = 'stderr';
+ }
+ delete $$self{opt_stderr};
+
+ # Validate the errors parameter and act on it.
+ if (not defined $$self{opt_errors}) {
+ $$self{opt_errors} = 'pod';
+ }
+ if ($$self{opt_errors} eq 'stderr' || $$self{opt_errors} eq 'die') {
$self->no_errata_section (1);
$self->complain_stderr (1);
- delete $$self{opt_stderr};
+ if ($$self{opt_errors} eq 'die') {
+ $$self{complain_die} = 1;
+ }
+ } elsif ($$self{opt_errors} eq 'pod') {
+ $self->no_errata_section (0);
+ $self->complain_stderr (0);
+ } elsif ($$self{opt_errors} eq 'none') {
+ $self->no_whining (1);
+ } else {
+ croak (qq(Invalid errors setting: "$$self{errors}"));
}
+ delete $$self{errors};
# Initialize various things from our parameters.
$$self{opt_alt} = 0 unless defined $$self{opt_alt};
@@ -279,7 +298,13 @@ sub output_code { $_[0]->output ($_[1]) }
# Set up various things that have to be initialized on a per-document basis.
sub start_document {
- my $self = shift;
+ my ($self, $attrs) = @_;
+ if ($$attrs{contentless} && !$$self{ALWAYS_EMIT_SOMETHING}) {
+ $$self{CONTENTLESS} = 1;
+ return;
+ } else {
+ delete $$self{CONTENTLESS};
+ }
my $margin = $$self{opt_indent} + $$self{opt_margin};
# Initialize a few per-document variables.
@@ -298,8 +323,9 @@ sub start_document {
if ($$self{opt_utf8}) {
$$self{ENCODE} = 1;
eval {
- my @layers = PerlIO::get_layers ($$self{output_fh});
- if (grep { $_ eq 'utf8' } @layers) {
+ my @options = (output => 1, details => 1);
+ my $flag = (PerlIO::get_layers ($$self{output_fh}, @options))[-1];
+ if ($flag & PerlIO::F_UTF8 ()) {
$$self{ENCODE} = 0;
}
};
@@ -308,6 +334,15 @@ sub start_document {
return '';
}
+# Handle the end of the document. The only thing we do is handle dying on POD
+# errors, since Pod::Parser currently doesn't.
+sub end_document {
+ my ($self) = @_;
+ if ($$self{complain_die} && $self->errors_seen) {
+ croak ("POD document had syntax errors");
+ }
+}
+
##############################################################################
# Text blocks
##############################################################################
@@ -583,6 +618,8 @@ sub cmd_l {
if ($$attrs{type} eq 'url') {
if (not defined($$attrs{to}) or $$attrs{to} eq $text) {
return "<$text>";
+ } elsif ($$self{opt_nourls}) {
+ return $text;
} else {
return "$text <$$attrs{to}>";
}
@@ -679,6 +716,17 @@ sub parse_from_filehandle {
$self->parse_from_file (@_);
}
+# Pod::Simple's parse_file doesn't set output_fh. Wrap the call and do so
+# ourself unless it was already set by the caller, since our documentation has
+# always said that this should work.
+sub parse_file {
+ my ($self, $in) = @_;
+ unless (defined $$self{output_fh}) {
+ $self->output_fh (\*STDOUT);
+ }
+ return $self->SUPER::parse_file ($in);
+}
+
##############################################################################
# Module return value and documentation
##############################################################################
@@ -686,13 +734,13 @@ sub parse_from_filehandle {
1;
__END__
+=for stopwords
+alt stderr Allbery Sean Burke's Christiansen UTF-8 pre-Unicode utf8 nourls
+
=head1 NAME
Pod::Text - Convert POD data to formatted ASCII text
-=for stopwords
-alt stderr Allbery Sean Burke's Christiansen UTF-8 pre-Unicode utf8
-
=head1 SYNOPSIS
use Pod::Text;
@@ -732,6 +780,16 @@ If set to a true value, the non-POD parts of the input file will be included
in the output. Useful for viewing code documented with POD blocks with the
POD rendered and the code left intact.
+=item errors
+
+How to report errors. C<die> says to throw an exception on any POD
+formatting error. C<stderr> says to report errors on standard error, but
+not to throw an exception. C<pod> says to include a POD ERRORS section
+in the resulting documentation summarizing the errors. C<none> ignores
+POD errors entirely, as much as possible.
+
+The default is C<output>.
+
=item indent
The number of spaces to indent regular text, and the default indentation for
@@ -753,6 +811,22 @@ for all text, including headings, not the amount by which regular text is
indented; for the latter, see the I<indent> option. To set the right
margin, see the I<width> option.
+=item nourls
+
+Normally, LZ<><> formatting codes with a URL but anchor text are formatted
+to show both the anchor text and the URL. In other words:
+
+ L<foo|http://example.com/>
+
+is formatted as:
+
+ foo <http://example.com/>
+
+This option, if set to a true value, suppresses the URL when anchor text
+is given, so this example would be formatted as just C<foo>. This can
+produce less cluttered output in cases where the URLs are not particularly
+important.
+
=item quotes
Sets the quote marks used to surround CE<lt>> text. If the value is a
@@ -774,7 +848,9 @@ single space. Defaults to true.
=item stderr
Send error messages about invalid POD to standard error instead of
-appending a POD ERRORS section to the generated output.
+appending a POD ERRORS section to the generated output. This is
+equivalent to setting C<errors> to C<stderr> if C<errors> is not already
+set. It is supported for backward compatibility.
=item utf8
@@ -816,10 +892,20 @@ messages indicate a bug in Pod::Text; you should never see them.
(F) Pod::Text was invoked via the compatibility mode pod2text() interface
and the input file it was given could not be opened.
+=item Invalid errors setting "%s"
+
+(F) The C<errors> parameter to the constructor was set to an unknown value.
+
=item Invalid quote specification "%s"
-(F) The quote specification given (the quotes option to the constructor) was
-invalid. A quote specification must be one, two, or four characters long.
+(F) The quote specification given (the C<quotes> option to the
+constructor) was invalid. A quote specification must be one, two, or four
+characters long.
+
+=item POD document had syntax errors
+
+(F) The POD document being formatted had syntax errors and the C<errors>
+option was set to C<die>.
=back
@@ -877,8 +963,8 @@ how to use Pod::Simple.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009 Russ Allbery
-<rra@stanford.edu>.
+Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009, 2012, 2013 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/Master/tlpkg/tlperl/lib/Pod/Text/Color.pm b/Master/tlpkg/tlperl/lib/Pod/Text/Color.pm
index 2e8864148b4..a114ed937f0 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Text/Color.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Text/Color.pm
@@ -1,13 +1,13 @@
# Pod::Text::Color -- Convert POD data to formatted color ASCII text
#
+# This is just a basic proof of concept. It should later be modified to make
+# better use of color, take options changing what colors are used for what
+# text, and the like.
+#
# Copyright 1999, 2001, 2004, 2006, 2008, 2009 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.
-#
-# This is just a basic proof of concept. It should later be modified to make
-# better use of color, take options changing what colors are used for what
-# text, and the like.
##############################################################################
# Modules and declarations
@@ -25,7 +25,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '2.06';
+$VERSION = '2.07';
##############################################################################
# Overrides
diff --git a/Master/tlpkg/tlperl/lib/Pod/Text/Overstrike.pm b/Master/tlpkg/tlperl/lib/Pod/Text/Overstrike.pm
index 7578f0f8f58..f5dce0230f8 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Text/Overstrike.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Text/Overstrike.pm
@@ -1,13 +1,5 @@
# Pod::Text::Overstrike -- Convert POD data to formatted overstrike text
#
-# Created by Joe Smith <Joe.Smith@inwap.com> 30-Nov-2000
-# (based on Pod::Text::Color by Russ Allbery <rra@stanford.edu>)
-# Copyright 2000 Joe Smith <Joe.Smith@inwap.com>.
-# Copyright 2001, 2004, 2008 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.
-#
# This was written because the output from:
#
# pod2text Text.pm > plain.txt; less plain.txt
@@ -18,6 +10,14 @@
#
# and because both Pod::Text::Color and Pod::Text::Termcap are not device
# independent.
+#
+# Created by Joe Smith <Joe.Smith@inwap.com> 30-Nov-2000
+# (based on Pod::Text::Color by Russ Allbery <rra@stanford.edu>)
+# Copyright 2000 Joe Smith <Joe.Smith@inwap.com>.
+# Copyright 2001, 2004, 2008 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.
##############################################################################
# Modules and declarations
@@ -34,7 +34,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '2.04';
+$VERSION = '2.05';
##############################################################################
# Overrides
diff --git a/Master/tlpkg/tlperl/lib/Pod/Text/Termcap.pm b/Master/tlpkg/tlperl/lib/Pod/Text/Termcap.pm
index e4885c9d262..86380606d8e 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Text/Termcap.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Text/Termcap.pm
@@ -1,14 +1,14 @@
# Pod::Text::Termcap -- Convert POD data to ASCII text with format escapes.
#
+# This is a simple subclass of Pod::Text that overrides a few key methods to
+# output the right termcap escape sequences for formatted text on the current
+# terminal type.
+#
# Copyright 1999, 2001, 2002, 2004, 2006, 2008, 2009
# 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.
-#
-# This is a simple subclass of Pod::Text that overrides a few key methods to
-# output the right termcap escape sequences for formatted text on the current
-# terminal type.
##############################################################################
# Modules and declarations
@@ -27,7 +27,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '2.06';
+$VERSION = '2.07';
##############################################################################
# Overrides
diff --git a/Master/tlpkg/tlperl/lib/Pod/Usage.pm b/Master/tlpkg/tlperl/lib/Pod/Usage.pm
index d060b275d1a..73802bb28ce 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Usage.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Usage.pm
@@ -11,9 +11,312 @@ package Pod::Usage;
use strict;
use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '1.51'; ## Current version of this package
+$VERSION = '1.61'; ## Current version of this package
require 5.005; ## requires this Perl version or later
+#use diagnostics;
+use Carp;
+use Config;
+use Exporter;
+use File::Spec;
+
+@EXPORT = qw(&pod2usage);
+BEGIN {
+ $Pod::Usage::Formatter ||=
+ ( $] >= 5.005_58 ? 'Pod::Text' : 'Pod::PlainText');
+ eval "require $Pod::Usage::Formatter";
+ die $@ if $@;
+ @ISA = ( $Pod::Usage::Formatter );
+}
+
+require Pod::Select;
+
+##---------------------------------------------------------------------------
+
+##---------------------------------
+## Function definitions begin here
+##---------------------------------
+
+sub pod2usage {
+ local($_) = shift;
+ my %opts;
+ ## Collect arguments
+ if (@_ > 0) {
+ ## Too many arguments - assume that this is a hash and
+ ## the user forgot to pass a reference to it.
+ %opts = ($_, @_);
+ }
+ elsif (!defined $_) {
+ $_ = '';
+ }
+ elsif (ref $_) {
+ ## User passed a ref to a hash
+ %opts = %{$_} if (ref($_) eq 'HASH');
+ }
+ elsif (/^[-+]?\d+$/) {
+ ## User passed in the exit value to use
+ $opts{'-exitval'} = $_;
+ }
+ else {
+ ## User passed in a message to print before issuing usage.
+ $_ and $opts{'-message'} = $_;
+ }
+
+ ## Need this for backward compatibility since we formerly used
+ ## options that were all uppercase words rather than ones that
+ ## looked like Unix command-line options.
+ ## to be uppercase keywords)
+ %opts = map {
+ my ($key, $val) = ($_, $opts{$_});
+ $key =~ s/^(?=\w)/-/;
+ $key =~ /^-msg/i and $key = '-message';
+ $key =~ /^-exit/i and $key = '-exitval';
+ lc($key) => $val;
+ } (keys %opts);
+
+ ## Now determine default -exitval and -verbose values to use
+ if ((! defined $opts{'-exitval'}) && (! defined $opts{'-verbose'})) {
+ $opts{'-exitval'} = 2;
+ $opts{'-verbose'} = 0;
+ }
+ elsif (! defined $opts{'-exitval'}) {
+ $opts{'-exitval'} = ($opts{'-verbose'} > 0) ? 1 : 2;
+ }
+ elsif (! defined $opts{'-verbose'}) {
+ $opts{'-verbose'} = (lc($opts{'-exitval'}) eq 'noexit' ||
+ $opts{'-exitval'} < 2);
+ }
+
+ ## Default the output file
+ $opts{'-output'} = (lc($opts{'-exitval'}) eq 'noexit' ||
+ $opts{'-exitval'} < 2) ? \*STDOUT : \*STDERR
+ unless (defined $opts{'-output'});
+ ## Default the input file
+ $opts{'-input'} = $0 unless (defined $opts{'-input'});
+
+ ## Look up input file in path if it doesnt exist.
+ unless ((ref $opts{'-input'}) || (-e $opts{'-input'})) {
+ my $basename = $opts{'-input'};
+ my $pathsep = ($^O =~ /^(?:dos|os2|MSWin32)$/i) ? ';'
+ : (($^O eq 'MacOS' || $^O eq 'VMS') ? ',' : ':');
+ my $pathspec = $opts{'-pathlist'} || $ENV{PATH} || $ENV{PERL5LIB};
+
+ my @paths = (ref $pathspec) ? @$pathspec : split($pathsep, $pathspec);
+ for my $dirname (@paths) {
+ $_ = File::Spec->catfile($dirname, $basename) if length;
+ last if (-e $_) && ($opts{'-input'} = $_);
+ }
+ }
+
+ ## Now create a pod reader and constrain it to the desired sections.
+ my $parser = new Pod::Usage(USAGE_OPTIONS => \%opts);
+ if ($opts{'-verbose'} == 0) {
+ $parser->select('(?:SYNOPSIS|USAGE)\s*');
+ }
+ elsif ($opts{'-verbose'} == 1) {
+ my $opt_re = '(?i)' .
+ '(?:OPTIONS|ARGUMENTS)' .
+ '(?:\s*(?:AND|\/)\s*(?:OPTIONS|ARGUMENTS))?';
+ $parser->select( '(?:SYNOPSIS|USAGE)\s*', $opt_re, "DESCRIPTION/$opt_re" );
+ }
+ elsif ($opts{'-verbose'} >= 2 && $opts{'-verbose'} != 99) {
+ $parser->select('.*');
+ }
+ elsif ($opts{'-verbose'} == 99) {
+ my $sections = $opts{'-sections'};
+ $parser->select( (ref $sections) ? @$sections : $sections );
+ $opts{'-verbose'} = 1;
+ }
+
+ ## Check for perldoc
+ my $progpath = File::Spec->catfile($Config{scriptdirexp}
+ || $Config{scriptdir}, 'perldoc');
+
+ my $version = sprintf("%vd",$^V);
+ if ($Config{versiononly} and $Config{startperl} =~ /\Q$version\E$/ ) {
+ $progpath .= $version;
+ }
+ $opts{'-noperldoc'} = 1 unless -e $progpath;
+
+ ## Now translate the pod document and then exit with the desired status
+ if ( !$opts{'-noperldoc'}
+ and $opts{'-verbose'} >= 2
+ and !ref($opts{'-input'})
+ and $opts{'-output'} == \*STDOUT )
+ {
+ ## spit out the entire PODs. Might as well invoke perldoc
+ print { $opts{'-output'} } ($opts{'-message'}, "\n") if($opts{'-message'});
+ if(defined $opts{-input} && $opts{-input} =~ /^\s*(\S.*?)\s*$/) {
+ # the perldocs back to 5.005 should all have -F
+ # without -F there are warnings in -T scripts
+ system($progpath, '-F', $1);
+ if($?) {
+ # RT16091: fall back to more if perldoc failed
+ system(($Config{pager} || $ENV{PAGER} || '/bin/more'), $1);
+ }
+ } else {
+ croak "Unspecified input file or insecure argument.\n";
+ }
+ }
+ else {
+ $parser->parse_from_file($opts{'-input'}, $opts{'-output'});
+ }
+
+ exit($opts{'-exitval'}) unless (lc($opts{'-exitval'}) eq 'noexit');
+}
+
+##---------------------------------------------------------------------------
+
+##-------------------------------
+## Method definitions begin here
+##-------------------------------
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %params = @_;
+ my $self = {%params};
+ bless $self, $class;
+ if ($self->can('initialize')) {
+ $self->initialize();
+ } else {
+ # pass through options to Pod::Text
+ my %opts;
+ for (qw(alt code indent loose margin quotes sentence stderr utf8 width)) {
+ my $val = $params{USAGE_OPTIONS}{"-$_"};
+ $opts{$_} = $val if defined $val;
+ }
+ $self = $self->SUPER::new(%opts);
+ %$self = (%$self, %params);
+ }
+ return $self;
+}
+
+sub select {
+ my ($self, @sections) = @_;
+ if ($ISA[0]->can('select')) {
+ $self->SUPER::select(@sections);
+ } else {
+ # we're using Pod::Simple - need to mimic the behavior of Pod::Select
+ my $add = ($sections[0] eq '+') ? shift(@sections) : '';
+ ## Reset the set of sections to use
+ unless (@sections) {
+ delete $self->{USAGE_SELECT} unless ($add);
+ return;
+ }
+ $self->{USAGE_SELECT} = []
+ unless ($add && $self->{USAGE_SELECT});
+ my $sref = $self->{USAGE_SELECT};
+ ## Compile each spec
+ for my $spec (@sections) {
+ my $cs = Pod::Select::_compile_section_spec($spec);
+ if ( defined $cs ) {
+ ## Store them in our sections array
+ push(@$sref, $cs);
+ } else {
+ carp qq{Ignoring section spec "$spec"!\n};
+ }
+ }
+ }
+}
+
+# Override Pod::Text->seq_i to return just "arg", not "*arg*".
+sub seq_i { return $_[1] }
+
+# This overrides the Pod::Text method to do something very akin to what
+# Pod::Select did as well as the work done below by preprocess_paragraph.
+# Note that the below is very, very specific to Pod::Text.
+sub _handle_element_end {
+ my ($self, $element) = @_;
+ if ($element eq 'head1') {
+ $self->{USAGE_HEADINGS} = [ $$self{PENDING}[-1][1] ];
+ if ($self->{USAGE_OPTIONS}->{-verbose} < 2) {
+ $$self{PENDING}[-1][1] =~ s/^\s*SYNOPSIS\s*$/USAGE/;
+ }
+ } elsif ($element =~ /^head(\d+)$/ && $1) { # avoid 0
+ my $idx = $1 - 1;
+ $self->{USAGE_HEADINGS} = [] unless($self->{USAGE_HEADINGS});
+ $self->{USAGE_HEADINGS}->[$idx] = $$self{PENDING}[-1][1];
+ }
+ if ($element =~ /^head\d+$/) {
+ $$self{USAGE_SKIPPING} = 1;
+ if (!$$self{USAGE_SELECT} || !@{ $$self{USAGE_SELECT} }) {
+ $$self{USAGE_SKIPPING} = 0;
+ } else {
+ my @headings = @{$$self{USAGE_HEADINGS}};
+ for my $section_spec ( @{$$self{USAGE_SELECT}} ) {
+ my $match = 1;
+ for (my $i = 0; $i < $Pod::Select::MAX_HEADING_LEVEL; ++$i) {
+ $headings[$i] = '' unless defined $headings[$i];
+ my $regex = $section_spec->[$i];
+ my $negated = ($regex =~ s/^\!//);
+ $match &= ($negated ? ($headings[$i] !~ /${regex}/)
+ : ($headings[$i] =~ /${regex}/));
+ last unless ($match);
+ } # end heading levels
+ if ($match) {
+ $$self{USAGE_SKIPPING} = 0;
+ last;
+ }
+ } # end sections
+ }
+
+ # Try to do some lowercasing instead of all-caps in headings, and use
+ # a colon to end all headings.
+ if($self->{USAGE_OPTIONS}->{-verbose} < 2) {
+ local $_ = $$self{PENDING}[-1][1];
+ s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge;
+ s/\s*$/:/ unless (/:\s*$/);
+ $_ .= "\n";
+ $$self{PENDING}[-1][1] = $_;
+ }
+ }
+ if ($$self{USAGE_SKIPPING} && $element !~ m/^over-/) {
+ pop @{ $$self{PENDING} };
+ } else {
+ $self->SUPER::_handle_element_end($element);
+ }
+}
+
+# required for Pod::Simple API
+sub start_document {
+ my $self = shift;
+ $self->SUPER::start_document();
+ my $msg = $self->{USAGE_OPTIONS}->{-message} or return 1;
+ my $out_fh = $self->output_fh();
+ print $out_fh "$msg\n";
+}
+
+# required for old Pod::Parser API
+sub begin_pod {
+ my $self = shift;
+ $self->SUPER::begin_pod(); ## Have to call superclass
+ my $msg = $self->{USAGE_OPTIONS}->{-message} or return 1;
+ my $out_fh = $self->output_handle();
+ print $out_fh "$msg\n";
+}
+
+sub preprocess_paragraph {
+ my $self = shift;
+ local $_ = shift;
+ my $line = shift;
+ ## See if this is a heading and we arent printing the entire manpage.
+ if (($self->{USAGE_OPTIONS}->{-verbose} < 2) && /^=head/) {
+ ## Change the title of the SYNOPSIS section to USAGE
+ s/^=head1\s+SYNOPSIS\s*$/=head1 USAGE/;
+ ## Try to do some lowercasing instead of all-caps in headings
+ s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge;
+ ## Use a colon to end all headings
+ s/\s*$/:/ unless (/:\s*$/);
+ $_ .= "\n";
+ }
+ return $self->SUPER::preprocess_paragraph($_);
+}
+
+1; # keep require happy
+
+__END__
+
=head1 NAME
Pod::Usage, pod2usage() - print a usage message from embedded pod documentation
@@ -149,11 +452,20 @@ output the POD.
=back
+=head2 Formatting base class
+
+The default text formatter depends on the Perl version (L<Pod::Text> or
+L<Pod::PlainText> for Perl versions E<lt> 5.005_58). The base class for
+Pod::Usage can be defined by pre-setting C<$Pod::Usage::Formatter> I<before>
+loading Pod::Usage, e.g.:
+
+ BEGIN { $Pod::Usage::Formatter = 'Pod::Text::Termcap'; }
+ use Pod::Usage qw(pod2usage);
+
=head2 Pass-through options
-The following options are passed through to the underlying text formatter
-(L<Pod::Text> or L<Pod::PlainText> for Perl versions E<lt> 5.005_58). See
-the manual pages of these modules for more information.
+The following options are passed through to the underlying text formatter.
+See the manual pages of these modules for more information.
alt code indent loose margin quotes sentence stderr utf8 width
@@ -422,7 +734,11 @@ similar to the following:
In the pathological case that a script is called via a relative path
I<and> the script itself changes the current working directory
(see L<perlfunc/chdir>) I<before> calling pod2usage, Pod::Usage will
-fail even on robust platforms. Don't do that.
+fail even on robust platforms. Don't do that. Or use L<FindBin> to locate
+the script:
+
+ use FindBin;
+ pod2usage(-input => $FindBin::Bin . "/" . $FindBin::Script);
=head1 AUTHOR
@@ -442,306 +758,10 @@ with re-writing this manpage.
=head1 SEE ALSO
-B<Pod::Usage> is part of the L<Pod::Parser> distribution.
+B<Pod::Usage> is now a standalone distribution.
-L<Pod::Parser>, L<Getopt::Long>, L<Pod::Find>
+L<Pod::Parser>, L<Pod::Perldoc>, L<Getopt::Long>, L<Pod::Find>, L<FindBin>,
+L<Pod::Text>, L<Pod::PlainText>, L<Pod::Text::Termcap>
=cut
-#############################################################################
-
-#use diagnostics;
-use Carp;
-use Config;
-use Exporter;
-use File::Spec;
-
-@EXPORT = qw(&pod2usage);
-BEGIN {
- if ( $] >= 5.005_58 ) {
- require Pod::Text;
- @ISA = qw( Pod::Text );
- }
- else {
- require Pod::PlainText;
- @ISA = qw( Pod::PlainText );
- }
-}
-
-require Pod::Select;
-
-##---------------------------------------------------------------------------
-
-##---------------------------------
-## Function definitions begin here
-##---------------------------------
-
-sub pod2usage {
- local($_) = shift;
- my %opts;
- ## Collect arguments
- if (@_ > 0) {
- ## Too many arguments - assume that this is a hash and
- ## the user forgot to pass a reference to it.
- %opts = ($_, @_);
- }
- elsif (!defined $_) {
- $_ = '';
- }
- elsif (ref $_) {
- ## User passed a ref to a hash
- %opts = %{$_} if (ref($_) eq 'HASH');
- }
- elsif (/^[-+]?\d+$/) {
- ## User passed in the exit value to use
- $opts{'-exitval'} = $_;
- }
- else {
- ## User passed in a message to print before issuing usage.
- $_ and $opts{'-message'} = $_;
- }
-
- ## Need this for backward compatibility since we formerly used
- ## options that were all uppercase words rather than ones that
- ## looked like Unix command-line options.
- ## to be uppercase keywords)
- %opts = map {
- my ($key, $val) = ($_, $opts{$_});
- $key =~ s/^(?=\w)/-/;
- $key =~ /^-msg/i and $key = '-message';
- $key =~ /^-exit/i and $key = '-exitval';
- lc($key) => $val;
- } (keys %opts);
-
- ## Now determine default -exitval and -verbose values to use
- if ((! defined $opts{'-exitval'}) && (! defined $opts{'-verbose'})) {
- $opts{'-exitval'} = 2;
- $opts{'-verbose'} = 0;
- }
- elsif (! defined $opts{'-exitval'}) {
- $opts{'-exitval'} = ($opts{'-verbose'} > 0) ? 1 : 2;
- }
- elsif (! defined $opts{'-verbose'}) {
- $opts{'-verbose'} = (lc($opts{'-exitval'}) eq 'noexit' ||
- $opts{'-exitval'} < 2);
- }
-
- ## Default the output file
- $opts{'-output'} = (lc($opts{'-exitval'}) eq 'noexit' ||
- $opts{'-exitval'} < 2) ? \*STDOUT : \*STDERR
- unless (defined $opts{'-output'});
- ## Default the input file
- $opts{'-input'} = $0 unless (defined $opts{'-input'});
-
- ## Look up input file in path if it doesnt exist.
- unless ((ref $opts{'-input'}) || (-e $opts{'-input'})) {
- my $basename = $opts{'-input'};
- my $pathsep = ($^O =~ /^(?:dos|os2|MSWin32)$/i) ? ';'
- : (($^O eq 'MacOS' || $^O eq 'VMS') ? ',' : ':');
- my $pathspec = $opts{'-pathlist'} || $ENV{PATH} || $ENV{PERL5LIB};
-
- my @paths = (ref $pathspec) ? @$pathspec : split($pathsep, $pathspec);
- for my $dirname (@paths) {
- $_ = File::Spec->catfile($dirname, $basename) if length;
- last if (-e $_) && ($opts{'-input'} = $_);
- }
- }
-
- ## Now create a pod reader and constrain it to the desired sections.
- my $parser = new Pod::Usage(USAGE_OPTIONS => \%opts);
- if ($opts{'-verbose'} == 0) {
- $parser->select('(?:SYNOPSIS|USAGE)\s*');
- }
- elsif ($opts{'-verbose'} == 1) {
- my $opt_re = '(?i)' .
- '(?:OPTIONS|ARGUMENTS)' .
- '(?:\s*(?:AND|\/)\s*(?:OPTIONS|ARGUMENTS))?';
- $parser->select( '(?:SYNOPSIS|USAGE)\s*', $opt_re, "DESCRIPTION/$opt_re" );
- }
- elsif ($opts{'-verbose'} >= 2 && $opts{'-verbose'} != 99) {
- $parser->select('.*');
- }
- elsif ($opts{'-verbose'} == 99) {
- my $sections = $opts{'-sections'};
- $parser->select( (ref $sections) ? @$sections : $sections );
- $opts{'-verbose'} = 1;
- }
-
- ## Now translate the pod document and then exit with the desired status
- if ( !$opts{'-noperldoc'}
- and $opts{'-verbose'} >= 2
- and !ref($opts{'-input'})
- and $opts{'-output'} == \*STDOUT )
- {
- ## spit out the entire PODs. Might as well invoke perldoc
- my $progpath = File::Spec->catfile($Config{scriptdirexp}
- || $Config{scriptdir}, 'perldoc');
- print { $opts{'-output'} } ($opts{'-message'}, "\n") if($opts{'-message'});
- if(defined $opts{-input} && $opts{-input} =~ /^\s*(\S.*?)\s*$/) {
- # the perldocs back to 5.005 should all have -F
- # without -F there are warnings in -T scripts
- system($progpath, '-F', $1);
- if($?) {
- # RT16091: fall back to more if perldoc failed
- system(($Config{pager} || $ENV{PAGER} || '/bin/more'), $1);
- }
- } else {
- croak "Unspecified input file or insecure argument.\n";
- }
- }
- else {
- $parser->parse_from_file($opts{'-input'}, $opts{'-output'});
- }
-
- exit($opts{'-exitval'}) unless (lc($opts{'-exitval'}) eq 'noexit');
-}
-
-##---------------------------------------------------------------------------
-
-##-------------------------------
-## Method definitions begin here
-##-------------------------------
-
-sub new {
- my $this = shift;
- my $class = ref($this) || $this;
- my %params = @_;
- my $self = {%params};
- bless $self, $class;
- if ($self->can('initialize')) {
- $self->initialize();
- } else {
- # pass through options to Pod::Text
- my %opts;
- for (qw(alt code indent loose margin quotes sentence stderr utf8 width)) {
- my $val = $params{USAGE_OPTIONS}{"-$_"};
- $opts{$_} = $val if defined $val;
- }
- $self = $self->SUPER::new(%opts);
- %$self = (%$self, %params);
- }
- return $self;
-}
-
-sub select {
- my ($self, @sections) = @_;
- if ($ISA[0]->can('select')) {
- $self->SUPER::select(@sections);
- } else {
- # we're using Pod::Simple - need to mimic the behavior of Pod::Select
- my $add = ($sections[0] eq '+') ? shift(@sections) : '';
- ## Reset the set of sections to use
- unless (@sections) {
- delete $self->{USAGE_SELECT} unless ($add);
- return;
- }
- $self->{USAGE_SELECT} = []
- unless ($add && $self->{USAGE_SELECT});
- my $sref = $self->{USAGE_SELECT};
- ## Compile each spec
- for my $spec (@sections) {
- my $cs = Pod::Select::_compile_section_spec($spec);
- if ( defined $cs ) {
- ## Store them in our sections array
- push(@$sref, $cs);
- } else {
- carp qq{Ignoring section spec "$spec"!\n};
- }
- }
- }
-}
-
-# Override Pod::Text->seq_i to return just "arg", not "*arg*".
-sub seq_i { return $_[1] }
-
-# This overrides the Pod::Text method to do something very akin to what
-# Pod::Select did as well as the work done below by preprocess_paragraph.
-# Note that the below is very, very specific to Pod::Text.
-sub _handle_element_end {
- my ($self, $element) = @_;
- if ($element eq 'head1') {
- $self->{USAGE_HEADINGS} = [ $$self{PENDING}[-1][1] ];
- if ($self->{USAGE_OPTIONS}->{-verbose} < 2) {
- $$self{PENDING}[-1][1] =~ s/^\s*SYNOPSIS\s*$/USAGE/;
- }
- } elsif ($element =~ /^head(\d+)$/ && $1) { # avoid 0
- my $idx = $1 - 1;
- $self->{USAGE_HEADINGS} = [] unless($self->{USAGE_HEADINGS});
- $self->{USAGE_HEADINGS}->[$idx] = $$self{PENDING}[-1][1];
- }
- if ($element =~ /^head\d+$/) {
- $$self{USAGE_SKIPPING} = 1;
- if (!$$self{USAGE_SELECT} || !@{ $$self{USAGE_SELECT} }) {
- $$self{USAGE_SKIPPING} = 0;
- } else {
- my @headings = @{$$self{USAGE_HEADINGS}};
- for my $section_spec ( @{$$self{USAGE_SELECT}} ) {
- my $match = 1;
- for (my $i = 0; $i < $Pod::Select::MAX_HEADING_LEVEL; ++$i) {
- $headings[$i] = '' unless defined $headings[$i];
- my $regex = $section_spec->[$i];
- my $negated = ($regex =~ s/^\!//);
- $match &= ($negated ? ($headings[$i] !~ /${regex}/)
- : ($headings[$i] =~ /${regex}/));
- last unless ($match);
- } # end heading levels
- if ($match) {
- $$self{USAGE_SKIPPING} = 0;
- last;
- }
- } # end sections
- }
-
- # Try to do some lowercasing instead of all-caps in headings, and use
- # a colon to end all headings.
- if($self->{USAGE_OPTIONS}->{-verbose} < 2) {
- local $_ = $$self{PENDING}[-1][1];
- s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge;
- s/\s*$/:/ unless (/:\s*$/);
- $_ .= "\n";
- $$self{PENDING}[-1][1] = $_;
- }
- }
- if ($$self{USAGE_SKIPPING} && $element !~ m/^over-/) {
- pop @{ $$self{PENDING} };
- } else {
- $self->SUPER::_handle_element_end($element);
- }
-}
-
-# required for Pod::Simple API
-sub start_document {
- my $self = shift;
- $self->SUPER::start_document();
- my $msg = $self->{USAGE_OPTIONS}->{-message} or return 1;
- my $out_fh = $self->output_fh();
- print $out_fh "$msg\n";
-}
-
-# required for old Pod::Parser API
-sub begin_pod {
- my $self = shift;
- $self->SUPER::begin_pod(); ## Have to call superclass
- my $msg = $self->{USAGE_OPTIONS}->{-message} or return 1;
- my $out_fh = $self->output_handle();
- print $out_fh "$msg\n";
-}
-
-sub preprocess_paragraph {
- my $self = shift;
- local $_ = shift;
- my $line = shift;
- ## See if this is a heading and we arent printing the entire manpage.
- if (($self->{USAGE_OPTIONS}->{-verbose} < 2) && /^=head/) {
- ## Change the title of the SYNOPSIS section to USAGE
- s/^=head1\s+SYNOPSIS\s*$/=head1 USAGE/;
- ## Try to do some lowercasing instead of all-caps in headings
- s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge;
- ## Use a colon to end all headings
- s/\s*$/:/ unless (/:\s*$/);
- $_ .= "\n";
- }
- return $self->SUPER::preprocess_paragraph($_);
-}
-
-1; # keep require happy