summaryrefslogtreecommitdiff
path: root/cpan/Pod-Simple/lib/Pod
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2012-08-14 23:48:38 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2012-08-15 00:33:34 +0100
commit0ace302a2635019d2fcbe257549cdf1497c4f585 (patch)
treefd12af51b52cf4d6ea4c1da6f5ef1dbb862e86a8 /cpan/Pod-Simple/lib/Pod
parent95ccf9d5dfbf8e9c58a97a47713562d01ddfc7cf (diff)
downloadperl-0ace302a2635019d2fcbe257549cdf1497c4f585.tar.gz
Upgrade to Pod-Simple 3.23
Diffstat (limited to 'cpan/Pod-Simple/lib/Pod')
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple.pm4
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple.pod25
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm36
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Checker.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Debug.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/DumpAsText.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm14
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/HTML.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/HTMLBatch.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/LinkSection.pm4
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Methody.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Progress.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/PullParser.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/PullParserEndToken.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/PullParserStartToken.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/PullParserTextToken.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/PullParserToken.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/RTF.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Search.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/SimpleTree.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Subclassing.pod14
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Text.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/TextContent.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/TiedOutFH.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/Transcode.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/TranscodeDumb.pm2
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/TranscodeSmart.pm4
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/XHTML.pm81
-rw-r--r--cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm2
29 files changed, 158 insertions, 66 deletions
diff --git a/cpan/Pod-Simple/lib/Pod/Simple.pm b/cpan/Pod-Simple/lib/Pod/Simple.pm
index ad7a19b8ef..fead5b5232 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple.pm
+++ b/cpan/Pod-Simple/lib/Pod/Simple.pm
@@ -18,7 +18,7 @@ use vars qw(
);
@ISA = ('Pod::Simple::BlackBox');
-$VERSION = '3.20';
+$VERSION = '3.23';
@Known_formatting_codes = qw(I B C L E F S X Z);
%Known_formatting_codes = map(($_=>1), @Known_formatting_codes);
@@ -87,6 +87,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)
diff --git a/cpan/Pod-Simple/lib/Pod/Simple.pod b/cpan/Pod-Simple/lib/Pod/Simple.pod
index a8ad211d3b..0ead93b1a3 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple.pod
+++ b/cpan/Pod-Simple/lib/Pod/Simple.pod
@@ -14,6 +14,8 @@ documentation") markup language that is typically used for writing
documentation for Perl and for Perl modules. The Pod format is explained
L<perlpod>; the most common formatter is called C<perldoc>.
+Be sure to read L</ENCODING> if your Pod contains non-ASCII characters.
+
Pod formatters can use Pod::Simple to parse Pod documents and render them into
plain text, HTML, or any number of other formats. Typically, such formatters
will be subclasses of Pod::Simple, and so they will inherit its methods, like
@@ -121,6 +123,14 @@ most likely to use.
=over
+=item C<< $parser->parse_characters( I<SOMEVALUE> ) >>
+
+The Pod parser normally expects to read octets and to convert those octets
+to characters based on the C<=encoding> declaration in the Pod source. Set
+this option to a true value to indicate that the Pod source is already a Perl
+character stream. This tells the parser to ignore any C<=encoding> command
+and to skip all the code paths involving decoding octets.
+
=item C<< $parser->no_whining( I<SOMEVALUE> ) >>
If you set this attribute to a true value, you will suppress the
@@ -322,6 +332,21 @@ Log an error unless C<< $parser->no_whining( TRUE ); >>.
=back
+=head1 ENCODING
+
+The Pod::Simple parser expects to read B<octets>. The parser will decode the
+octets into Perl's internal character string representation using the value of
+the C<=encoding> declaration in the POD source.
+
+If the POD source does not include an C<=encoding> declaration, the parser will
+attempt to guess the encoding (selecting one of UTF-8 or Latin-1) by examining
+the first non-ASCII bytes and applying the heuristic described in
+L<perlpodspec>.
+
+If you set the C<parse_characters> option to a true value the parser will
+expect characters rather than octets; will ignore any C<=encoding>; and will
+make no attempt to decode the input.
+
=head1 CAVEATS
This is just a beta release -- there are a good number of things still
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm b/cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm
index c17cfd0ad5..d3878f826d 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm
+++ b/cpan/Pod-Simple/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.23';
#use constant DEBUG => 7;
BEGIN {
require Pod::Simple;
@@ -123,6 +123,9 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines)
}
}
+ if(!$self->parse_characters && !$self->{'encoding'}) {
+ $self->_try_encoding_guess($line)
+ }
DEBUG > 5 and print "# Parsing line: [$line]\n";
@@ -176,6 +179,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 +273,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;
@@ -395,6 +401,28 @@ sub _handle_encoding_second_level {
return;
}
+sub _try_encoding_guess {
+ my ($self,$line) = @_;
+
+ if(!$self->{'in_pod'} and $line !~ /^=/m) {
+ return; # don't whine about non-ASCII bytes in code/comments
+ }
+
+ return unless $line =~ /[^\x00-\x7f]/; # Look for non-ASCII byte
+
+ my $encoding = $line =~ /[\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"
+ );
+
+}
+
#~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`
{
@@ -1459,10 +1487,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);
}
}
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Checker.pm b/cpan/Pod-Simple/lib/Pod/Simple/Checker.pm
index c97267a86b..42c942ac8f 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Checker.pm
+++ b/cpan/Pod-Simple/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.23';
@ISA = ('Pod::Simple::Methody');
BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG)
? \&Pod::Simple::DEBUG
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Debug.pm b/cpan/Pod-Simple/lib/Pod/Simple/Debug.pm
index 5773302842..d9bd4e43a8 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Debug.pm
+++ b/cpan/Pod-Simple/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.23';
sub import {
my($value,$variable);
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/DumpAsText.pm b/cpan/Pod-Simple/lib/Pod/Simple/DumpAsText.pm
index 5e2d7ebf5f..c86d4ebd4e 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/DumpAsText.pm
+++ b/cpan/Pod-Simple/lib/Pod/Simple/DumpAsText.pm
@@ -1,7 +1,7 @@
require 5;
package Pod::Simple::DumpAsText;
-$VERSION = '3.20';
+$VERSION = '3.23';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm b/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm
index e43422bbd7..576ca7d369 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm
+++ b/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm
@@ -1,13 +1,14 @@
require 5;
package Pod::Simple::DumpAsXML;
-$VERSION = '3.20';
+$VERSION = '3.23';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
use strict;
use Carp ();
+use Text::Wrap qw(wrap);
BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG }
@@ -49,15 +50,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;
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/HTML.pm b/cpan/Pod-Simple/lib/Pod/Simple/HTML.pm
index 12fad40358..528581e212 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/HTML.pm
+++ b/cpan/Pod-Simple/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.23';
BEGIN {
if(defined &DEBUG) { } # no-op
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/HTMLBatch.pm b/cpan/Pod-Simple/lib/Pod/Simple/HTMLBatch.pm
index 52e77bcc1b..70e28edc20 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/HTMLBatch.pm
+++ b/cpan/Pod-Simple/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.23';
@ISA = (); # Yup, we're NOT a subclass of Pod::Simple::HTML!
# TODO: nocontents stylesheets. Strike some of the color variations?
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/LinkSection.pm b/cpan/Pod-Simple/lib/Pod/Simple/LinkSection.pm
index 5aa5bc1989..fb80a59ba0 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/LinkSection.pm
+++ b/cpan/Pod-Simple/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.23';
use strict;
use Pod::Simple::BlackBox;
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.23';
use overload( # So it'll stringify nice
'""' => \&Pod::Simple::BlackBox::stringify_lol,
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Methody.pm b/cpan/Pod-Simple/lib/Pod/Simple/Methody.pm
index 4113daf235..2f6a52823f 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Methody.pm
+++ b/cpan/Pod-Simple/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.23';
@ISA = ('Pod::Simple');
# Yes, we could use named variables, but I want this to be impose
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Progress.pm b/cpan/Pod-Simple/lib/Pod/Simple/Progress.pm
index e85084a1c2..9c0e9d9ce4 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Progress.pm
+++ b/cpan/Pod-Simple/lib/Pod/Simple/Progress.pm
@@ -1,7 +1,7 @@
require 5;
package Pod::Simple::Progress;
-$VERSION = '3.20';
+$VERSION = '3.23';
use strict;
# Objects of this class are used for noting progress of an
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/PullParser.pm b/cpan/Pod-Simple/lib/Pod/Simple/PullParser.pm
index c9726fd564..053fbf33f1 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/PullParser.pm
+++ b/cpan/Pod-Simple/lib/Pod/Simple/PullParser.pm
@@ -1,7 +1,7 @@
require 5;
package Pod::Simple::PullParser;
-$VERSION = '3.20';
+$VERSION = '3.23';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/PullParserEndToken.pm b/cpan/Pod-Simple/lib/Pod/Simple/PullParserEndToken.pm
index a45aba18ba..aaa5796b50 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/PullParserEndToken.pm
+++ b/cpan/Pod-Simple/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.23';
sub new { # Class->new(tagname);
my $class = shift;
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/PullParserStartToken.pm b/cpan/Pod-Simple/lib/Pod/Simple/PullParserStartToken.pm
index e9fbaa2b5e..ee4c48491b 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/PullParserStartToken.pm
+++ b/cpan/Pod-Simple/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.23';
sub new { # Class->new(tagname, optional_attrhash);
my $class = shift;
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/PullParserTextToken.pm b/cpan/Pod-Simple/lib/Pod/Simple/PullParserTextToken.pm
index 34985fdfb0..872fa25862 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/PullParserTextToken.pm
+++ b/cpan/Pod-Simple/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.23';
sub new { # Class->new(text);
my $class = shift;
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/PullParserToken.pm b/cpan/Pod-Simple/lib/Pod/Simple/PullParserToken.pm
index b323ece2a3..41251886e6 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/PullParserToken.pm
+++ b/cpan/Pod-Simple/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.23';
use strict;
sub new { # Class->new('type', stuff...); ## Overridden in derived classes anyway
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/RTF.pm b/cpan/Pod-Simple/lib/Pod/Simple/RTF.pm
index 0d184e3a66..3663d043d0 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/RTF.pm
+++ b/cpan/Pod-Simple/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.23';
use Pod::Simple::PullParser ();
BEGIN {@ISA = ('Pod::Simple::PullParser')}
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Search.pm b/cpan/Pod-Simple/lib/Pod/Simple/Search.pm
index 7e507e62b9..79fb37aac3 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Search.pm
+++ b/cpan/Pod-Simple/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.23'; ## Current version of this package
BEGIN { *DEBUG = sub () {0} unless defined &DEBUG; } # set DEBUG level
use Carp ();
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/SimpleTree.pm b/cpan/Pod-Simple/lib/Pod/Simple/SimpleTree.pm
index 3671af121f..940c0f340e 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/SimpleTree.pm
+++ b/cpan/Pod-Simple/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.23';
BEGIN {
@ISA = ('Pod::Simple');
*DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG;
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Subclassing.pod b/cpan/Pod-Simple/lib/Pod/Simple/Subclassing.pod
index 792d1be5a2..6be2defcc8 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Subclassing.pod
+++ b/cpan/Pod-Simple/lib/Pod/Simple/Subclassing.pod
@@ -378,13 +378,13 @@ That is, they all produce the same event structure (for the most part), namely:
&#34;Member Data&#34;
</L>
-The I<raw> attribute depends on what the raw content of the L<> is, so that is
-why the event structure is the same "for the most part".
+The I<raw> attribute depends on what the raw content of the C<LE<lt>E<gt>> is,
+so that is why the event structure is the same "for the most part".
If you have not guessed it yet, the I<raw> attribute contains the raw,
-original, unescaped content of the L<> formatting code. In addition to the
-examples above, take notice of the following event structure produced by
-the following L<> formatting code.
+original, unescaped content of the C<LE<lt>E<gt>> formatting code. In addition
+to the examples above, take notice of the following event structure produced
+by the following C<LE<lt>E<gt>> formatting code.
L<click B<here>|page/About the C<-M> switch>
@@ -725,10 +725,10 @@ or
=end html
...the parser will ignore these sections unless your subclass has
-specified that it wants to see sections targetted to "html" (or whatever
+specified that it wants to see sections targeted to "html" (or whatever
the formatter name is).
-If you want to process all sections, even if they're not targetted for you,
+If you want to process all sections, even if they're not targeted for you,
call this before you start parsing:
$parser->accept_targets('*');
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Text.pm b/cpan/Pod-Simple/lib/Pod/Simple/Text.pm
index 3032d0fcd5..3e0c022894 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Text.pm
+++ b/cpan/Pod-Simple/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.23';
@ISA = ('Pod::Simple::Methody');
BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG)
? \&Pod::Simple::DEBUG
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/TextContent.pm b/cpan/Pod-Simple/lib/Pod/Simple/TextContent.pm
index dea1cde7cc..758b78f16f 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/TextContent.pm
+++ b/cpan/Pod-Simple/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.23';
@ISA = ('Pod::Simple');
sub new {
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/TiedOutFH.pm b/cpan/Pod-Simple/lib/Pod/Simple/TiedOutFH.pm
index 9f2a224a27..3e99202b7f 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/TiedOutFH.pm
+++ b/cpan/Pod-Simple/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.23';
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/Transcode.pm b/cpan/Pod-Simple/lib/Pod/Simple/Transcode.pm
index 892436db7f..fcaf4e62c9 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/Transcode.pm
+++ b/cpan/Pod-Simple/lib/Pod/Simple/Transcode.pm
@@ -2,7 +2,7 @@
require 5;
package Pod::Simple::Transcode;
use vars qw($VERSION );
-$VERSION = '3.20';
+$VERSION = '3.23';
BEGIN {
if(defined &DEBUG) {;} # Okay
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/TranscodeDumb.pm b/cpan/Pod-Simple/lib/Pod/Simple/TranscodeDumb.pm
index 3303090343..32e98399a1 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/TranscodeDumb.pm
+++ b/cpan/Pod-Simple/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.23';
# 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/cpan/Pod-Simple/lib/Pod/Simple/TranscodeSmart.pm b/cpan/Pod-Simple/lib/Pod/Simple/TranscodeSmart.pm
index a66dedd03b..0dec8b5def 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/TranscodeSmart.pm
+++ b/cpan/Pod-Simple/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.23';
sub is_dumb {0}
sub is_smart {1}
@@ -32,7 +32,7 @@ sub make_transcoder {
my $x;
return sub {
foreach $x (@_) {
- $x = Encode::decode($e, $x);
+ $x = Encode::decode($e, $x) unless Encode::is_utf8($x);
}
return;
};
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/XHTML.pm b/cpan/Pod-Simple/lib/Pod/Simple/XHTML.pm
index 9d31db0bad..5fd0967f8e 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/XHTML.pm
+++ b/cpan/Pod-Simple/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.23';
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
@@ -327,19 +342,44 @@ sub accept_targets_as_html {
}
sub handle_text {
+ if ($_[0]{'in_code'} && @{$_[0]{'in_code'}}) {
+ return $_[0]->handle_code( $_[1], $_[0]{'in_code'}[-1] );
+ }
# 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] );
+
+ $_[0]{'scratch'} .= $text;
+ $_[0]{htext} .= $text if $_[0]{'in_head'};
+}
+
+sub start_code {
+ $_[0]{'scratch'} .= '<code>';
}
-sub start_Para { $_[0]{'scratch'} = '<p>' }
-sub start_Verbatim { $_[0]{'scratch'} = '<pre><code>' }
+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 }
-sub start_head2 { $_[0]{'in_head'} = 2 }
-sub start_head3 { $_[0]{'in_head'} = 3 }
-sub start_head4 { $_[0]{'in_head'} = 4 }
+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 +437,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 +449,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 +609,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>' }
diff --git a/cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm b/cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm
index bbb815a552..1cbc3368cb 100644
--- a/cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm
+++ b/cpan/Pod-Simple/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.23';
BEGIN {
@ISA = ('Pod::Simple');
*DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG;