summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Pod
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Pod')
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Html.pm178
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/LaTeX.pm15
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Man.pm40
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc.pm8
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Plainer.pm100
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm173
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm8
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParser.pm19
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm8
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm10
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Subclassing.pod32
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm2
-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.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm109
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/Pod/Text.pm34
35 files changed, 472 insertions, 334 deletions
diff --git a/Master/tlpkg/tlperl/lib/Pod/Html.pm b/Master/tlpkg/tlperl/lib/Pod/Html.pm
index 6174dd74576..2c5c4414cf2 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.09;
+$VERSION = 1.11;
@ISA = qw(Exporter);
@EXPORT = qw(pod2html htmlify);
@EXPORT_OK = qw(anchorify);
@@ -360,14 +360,17 @@ sub pod2html {
$Backlink = html_escape($Backlink) if defined $Backlink;
# set some variables to their default values if necessary
- local *POD;
+ my $pod;
unless (@ARGV && $ARGV[0]) {
- $Podfile = "-" unless $Podfile; # stdin
- open(POD, "<$Podfile")
- || die "$0: cannot open $Podfile file for input: $!\n";
+ if ($Podfile and $Podfile ne '-') {
+ open $pod, '<', $Podfile
+ or die "$0: cannot open $Podfile file for input: $!\n";
+ } else {
+ open $pod, '-';
+ }
} else {
$Podfile = $ARGV[0]; # XXX: might be more filenames
- *POD = *ARGV;
+ $pod = *ARGV;
}
$Htmlfile = "-" unless $Htmlfile; # stdout
$Htmlroot = "" if $Htmlroot eq "/"; # so we don't get a //
@@ -388,8 +391,8 @@ sub pod2html {
# read the pod a paragraph at a time
warn "Scanning for sections in input file(s)\n" if $Verbose;
$/ = "";
- my @poddata = <POD>;
- close(POD);
+ my @poddata = <$pod>;
+ close $pod;
# be eol agnostic
for (@poddata) {
@@ -419,8 +422,13 @@ sub pod2html {
}
# open the output file
- open(HTML, ">$Htmlfile")
- || die "$0: cannot open $Htmlfile file for output: $!\n";
+ my $html;
+ if($Htmlfile and $Htmlfile ne '-') {
+ open $html, ">", $Htmlfile
+ or die "$0: cannot open $Htmlfile file for output: $!\n";
+ } else {
+ open $html, ">-";
+ }
# put a title in the HTML file if one wasn't specified
if ($Title eq '') {
@@ -474,7 +482,7 @@ sub pod2html {
</table>
END_OF_BLOCK
- print HTML <<END_OF_HEAD;
+ print $html <<END_OF_HEAD;
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -506,7 +514,7 @@ END_OF_HEAD
$index = qq(<!--\n$index\n-->\n);
}
- print HTML << "END_OF_INDEX";
+ print $html <<"END_OF_INDEX";
<!-- INDEX BEGIN -->
<div name="index">
@@ -529,7 +537,7 @@ END_OF_INDEX
$after_item = 0;
$_ = $1;
if (/^=begin\s+(\S+)\s*(.*)/si) {# =begin
- process_begin($1, $2);
+ process_begin($html, $1, $2);
} elsif (/^=end\s+(\S+)\s*(.*)/si) {# =end
process_end($1, $2);
} elsif (/^=cut/) { # =cut
@@ -540,16 +548,16 @@ END_OF_INDEX
next if @Begin_Stack && $Begin_Stack[-1] ne 'html';
if (/^=(head[1-6])\s+(.*\S)/s) { # =head[1-6] heading
- process_head( $1, $2, $Doindex && $index );
+ process_head( $html, $1, $2, $Doindex && $index );
} elsif (/^=item\s*(.*\S)?/sm) { # =item text
- process_item( $1 );
+ process_item( $html, $1 );
$after_item = 1;
} elsif (/^=over\s*(.*)/) { # =over N
process_over();
} elsif (/^=back/) { # =back
- process_back();
+ process_back( $html );
} elsif (/^=for\s+(\S+)\s*(.*)/si) {# =for
- process_for($1,$2);
+ process_for( $html, $1, $2 );
} else {
/^=(\S*)\s*/;
warn "$0: $Podfile: unknown pod directive '$1' in "
@@ -560,19 +568,21 @@ END_OF_INDEX
}
else {
next if $Ignore;
- next if @Begin_Stack && $Begin_Stack[-1] ne 'html';
- print HTML and next if @Begin_Stack && $Begin_Stack[-1] eq 'html';
+ if (@Begin_Stack) {
+ print $html $_ if $Begin_Stack[-1] eq 'html';
+ next;
+ }
my $text = $_;
# Open tag for definition list as we have something to put in it
if( $ListNewTerm ){
- print HTML "<dd>\n";
+ print $html "<dd>\n";
$ListNewTerm = 0;
}
if( $text =~ /\A\s+/ ){
process_pre( \$text );
- print HTML "<pre>\n$text</pre>\n";
+ print $html "<pre>\n$text</pre>\n";
} else {
process_text( \$text );
@@ -599,20 +609,20 @@ END_OF_INDEX
}
## end of experimental
- print HTML "<p>$text</p>\n";
+ print $html "<p>$text</p>\n";
}
$after_item = 0;
}
}
# finish off any pending directives
- finish_list();
+ finish_list( $html );
# link to page index
- print HTML "<p><a href=\"#__index__\"><small>$Backlink</small></a></p>\n"
+ print $html "<p><a href=\"#__index__\"><small>$Backlink</small></a></p>\n"
if $Doindex and $index and $Backlink;
- print HTML <<END_OF_TAIL;
+ print $html <<END_OF_TAIL;
$block
</body>
@@ -620,7 +630,7 @@ $block
END_OF_TAIL
# close the html file
- close(HTML);
+ close $html or die "Failed to close $Htmlfile: $!";
warn "Finished\n" if $Verbose;
}
@@ -885,10 +895,10 @@ sub scan_podpath {
# scan each .pod and .pm file for =item directives
foreach $pod (@files) {
- open(POD, "<$dirname/$pod") ||
- die "$0: error opening $dirname/$pod for input: $!\n";
- @poddata = <POD>;
- close(POD);
+ open my $fh, '<', "$dirname/$pod"
+ or die "$0: error opening $dirname/$pod for input: $!\n";
+ @poddata = <$fh>;
+ close $fh;
clean_data( \@poddata );
scan_items( \%Items, "$dirname/$pod", @poddata);
@@ -904,10 +914,10 @@ sub scan_podpath {
$Pages{$libpod} =~ /([^:]*\.pm):/) {
# scan the .pod or .pm file for =item directives
$pod = $1;
- open(POD, "<$pod") ||
- die "$0: error opening $pod for input: $!\n";
- @poddata = <POD>;
- close(POD);
+ open my $fh, '<', $pod
+ or die "$0: error opening $pod for input: $!\n";
+ @poddata = <$fh>;
+ close $fh;
clean_data( \@poddata );
scan_items( \%Items, "$pod", @poddata);
@@ -922,27 +932,27 @@ sub scan_podpath {
# cache the item list for later use
warn "caching items for later use\n" if $Verbose;
- open(CACHE, ">$Itemcache") ||
- die "$0: error open $Itemcache for writing: $!\n";
+ open my $cache, '>', $Itemcache
+ or die "$0: error open $Itemcache for writing: $!\n";
- print CACHE join(":", @Podpath) . "\n$podroot\n";
+ print $cache join(":", @Podpath) . "\n$podroot\n";
foreach my $key (keys %Items) {
- print CACHE "$key $Items{$key}\n";
+ print $cache "$key $Items{$key}\n";
}
- close(CACHE);
+ close $cache or die "error closing $Itemcache: $!";
# cache the directory list for later use
warn "caching directories for later use\n" if $Verbose;
- open(CACHE, ">$Dircache") ||
- die "$0: error open $Dircache for writing: $!\n";
+ open $cache, '>', $Dircache
+ or die "$0: error open $Dircache for writing: $!\n";
- print CACHE join(":", @Podpath) . "\n$podroot\n";
+ print $cache join(":", @Podpath) . "\n$podroot\n";
foreach my $key (keys %Pages) {
- print CACHE "$key $Pages{$key}\n";
+ print $cache "$key $Pages{$key}\n";
}
- close(CACHE);
+ close $cache or die "error closing $Dircache: $!";
}
#
@@ -1094,26 +1104,26 @@ sub scan_items {
# process_head - convert a pod head[1-6] tag and convert it to HTML format.
#
sub process_head {
- my($tag, $heading, $hasindex) = @_;
+ my($fh, $tag, $heading, $hasindex) = @_;
# figure out the level of the =head
$tag =~ /head([1-6])/;
my $level = $1;
- finish_list();
+ finish_list( $fh );
- print HTML "<p>\n";
+ print $fh "<p>\n";
if( $level == 1 && ! $Top ){
- print HTML "<a href=\"#__index__\"><small>$Backlink</small></a>\n"
+ print $fh "<a href=\"#__index__\"><small>$Backlink</small></a>\n"
if $hasindex and $Backlink;
- print HTML "</p>\n<hr />\n"
+ print $fh "</p>\n<hr />\n"
} else {
- print HTML "</p>\n";
+ print $fh "</p>\n";
}
my $name = anchorify( depod( $heading ) );
my $convert = process_text( \$heading );
- print HTML "<h$level><a name=\"$name\">$convert</a></h$level>\n";
+ print $fh "<h$level><a name=\"$name\">$convert</a></h$level>\n";
}
@@ -1123,55 +1133,55 @@ sub process_head {
#
my $EmittedItem;
-sub emit_item_tag($$$){
- my( $otext, $text, $compact ) = @_;
+sub emit_item_tag {
+ my( $fh, $otext, $text, $compact ) = @_;
my $item = fragment_id( depod($text) , -generate);
Carp::confess("Undefined fragment '$text' (".depod($text).") from fragment_id() in emit_item_tag() in $Podfile")
if !defined $item;
$EmittedItem = $item;
### print STDERR "emit_item_tag=$item ($text)\n";
- print HTML '<strong>';
+ print $fh '<strong>';
if ($Items_Named{$item}++) {
- print HTML process_text( \$otext );
+ print $fh process_text( \$otext );
} else {
my $name = $item;
$name = anchorify($name);
- print HTML qq{<a name="$name" class="item">}, process_text( \$otext ), '</a>';
+ print $fh qq{<a name="$name" class="item">}, process_text( \$otext ), '</a>';
}
- print HTML "</strong>";
+ print $fh "</strong>";
undef( $EmittedItem );
}
sub new_listitem {
- my( $tag ) = @_;
+ my ($fh, $tag) = @_;
# Open tag for definition list as we have something to put in it
if( ($tag ne 'dl') && ($ListNewTerm) ){
- print HTML "<dd>\n";
+ print $fh "<dd>\n";
$ListNewTerm = 0;
}
if( $Items_Seen[$Listlevel]++ == 0 ){
# start of new list
push( @Listtype, "$tag" );
- print HTML "<$tag>\n";
+ print $fh "<$tag>\n";
} else {
# if this is not the first item, close the previous one
if ( $tag eq 'dl' ){
- print HTML "</dd>\n" unless $ListNewTerm;
+ print $fh "</dd>\n" unless $ListNewTerm;
} else {
- print HTML "</li>\n";
+ print $fh "</li>\n";
}
}
my $opentag = $tag eq 'dl' ? 'dt' : 'li';
- print HTML "<$opentag>";
+ print $fh "<$opentag>";
}
#
# process_item - convert a pod item tag and convert it to HTML format.
#
sub process_item {
- my( $otext ) = @_;
+ my ($fh, $otext) = @_;
# lots of documents start a list without doing an =over. this is
# bad! but, the proper thing to do seems to be to just assume
@@ -1186,36 +1196,36 @@ sub process_item {
# all the list variants:
if( $text =~ /\A\*/ ){ # bullet
- new_listitem( 'ul' );
+ new_listitem( $fh, 'ul' );
if ($text =~ /\A\*\s+(\S.*)\Z/s ) { # with additional text
my $tag = $1;
$otext =~ s/\A\*\s+//;
- emit_item_tag( $otext, $tag, 1 );
- print HTML "\n";
+ emit_item_tag( $fh, $otext, $tag, 1 );
+ print $fh "\n";
}
} elsif( $text =~ /\A\d+/ ){ # numbered list
- new_listitem( 'ol' );
+ new_listitem( $fh, 'ol' );
if ($text =~ /\A(?>\d+\.?)\s*(\S.*)\Z/s ) { # with additional text
my $tag = $1;
$otext =~ s/\A\d+\.?\s*//;
- emit_item_tag( $otext, $tag, 1 );
- print HTML "\n";
+ emit_item_tag( $fh, $otext, $tag, 1 );
+ print $fh "\n";
}
} else { # definition list
# new_listitem takes care of opening the <dt> tag
- new_listitem( 'dl' );
+ new_listitem( $fh, 'dl' );
if ($text =~ /\A(.+)\Z/s ){ # should have text
- emit_item_tag( $otext, $text, 1 );
+ emit_item_tag( $fh, $otext, $text, 1 );
# write the definition term and close <dt> tag
- print HTML "</dt>\n";
+ print $fh "</dt>\n";
}
# trigger opening a <dd> tag for the actual definition; will not
# happen if next paragraph is also a definition term (=item)
$ListNewTerm = 1;
}
- print HTML "\n";
+ print $fh "\n";
}
#
@@ -1231,6 +1241,7 @@ sub process_over {
# process_back - process a pod back tag and convert it to HTML format.
#
sub process_back {
+ my $fh = shift;
if( $Listlevel == 0 ){
warn "$0: $Podfile: unexpected =back directive in paragraph $Paragraph. ignoring.\n" unless $Quiet;
return;
@@ -1242,11 +1253,11 @@ sub process_back {
$Listlevel--;
if( defined $Listtype[$Listlevel] ){
if ( $Listtype[$Listlevel] eq 'dl' ){
- print HTML "</dd>\n" unless $ListNewTerm;
+ print $fh "</dd>\n" unless $ListNewTerm;
} else {
- print HTML "</li>\n";
+ print $fh "</li>\n";
}
- print HTML "</$Listtype[$Listlevel]>\n";
+ print $fh "</$Listtype[$Listlevel]>\n";
pop( @Listtype );
$ListNewTerm = 0;
}
@@ -1275,15 +1286,15 @@ sub process_pod {
# it out verbatim, if illustration, center it, otherwise ignore it.
#
sub process_for {
- my($whom, $text) = @_;
+ my ($fh, $whom, $text) = @_;
if ( $whom =~ /^(pod2)?html$/i) {
- print HTML $text;
+ print $fh $text;
} elsif ($whom =~ /^illustration$/i) {
1 while chomp $text;
for my $ext (qw[.png .gif .jpeg .jpg .tga .pcl .bmp]) {
$text .= $ext, last if -r "$text$ext";
}
- print HTML qq{<p align="center"><img src="$text" alt="$text illustration" /></p>};
+ print $fh qq{<p align="center"><img src="$text" alt="$text illustration" /></p>};
}
}
@@ -1293,11 +1304,11 @@ sub process_for {
# begin stack, we only print if it us.
#
sub process_begin {
- my($whom, $text) = @_;
+ my ($fh, $whom, $text) = @_;
$whom = lc($whom);
push (@Begin_Stack, $whom);
if ( $whom =~ /^(pod2)?html$/) {
- print HTML $text if $text;
+ print $fh $text if $text;
}
}
@@ -2034,10 +2045,11 @@ sub relative_url {
# after the entire pod file has been read and converted.
#
sub finish_list {
+ my $fh = shift;
if( $Listlevel ){
warn "$0: $Podfile: unterminated list(s) at =head in paragraph $Paragraph. ignoring.\n" unless $Quiet;
while( $Listlevel ){
- process_back();
+ process_back( $fh );
}
}
}
diff --git a/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm b/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm
index 9d3a905258f..6404b27f578 100644
--- a/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/LaTeX.pm
@@ -33,7 +33,7 @@ use Carp;
use vars qw/ $VERSION %HTML_Escapes @LatexSections /;
-$VERSION = '0.58';
+$VERSION = '0.59';
# Definitions of =headN -> latex mapping
@LatexSections = (qw/
@@ -494,7 +494,7 @@ If used in conjunction with C<AddPostamble> a full latex document will
be written that could be immediately processed by C<latex>.
For some pod escapes it may be necessary to include the amsmath
-package. This is not yet added to the preamble automaatically.
+package. This is not yet added to the preamble automatically.
=cut
@@ -1839,7 +1839,7 @@ Some HTML escapes are missing and many have not been tested.
=head1 SEE ALSO
-L<Pod::Parser>, L<Pod::Select>, L<pod2latex>
+L<Pod::Parser>, L<Pod::Select>, L<pod2latex>, L<Pod::Simple>.
=head1 AUTHORS
@@ -1852,12 +1852,13 @@ E<lt>marcel@codewerk.comE<gt>, Hugh S Myers
E<lt>hsmyers@sdragons.comE<gt>, Peter J Acklam
E<lt>jacklam@math.uio.noE<gt>, Sudhi Herle E<lt>sudhi@herle.netE<gt>,
Ariel Scolnicov E<lt>ariels@compugen.co.ilE<gt>,
-Adriano Rodrigues Ferreira E<lt>ferreira@triang.com.brE<gt> and
-R. de Vries E<lt>r.de.vries@dutchspace.nlE<gt>.
-
+Adriano Rodrigues Ferreira E<lt>ferreira@triang.com.brE<gt>,
+R. de Vries E<lt>r.de.vries@dutchspace.nlE<gt> and
+Dave Mitchell E<lt>davem@iabyn.comE<gt>.
=head1 COPYRIGHT
+Copyright (C) 2011 Tim Jenness.
Copyright (C) 2000-2004 Tim Jenness. All Rights Reserved.
This program is free software; you can redistribute it and/or modify
@@ -1867,7 +1868,7 @@ it under the same terms as Perl itself.
=head1 REVISION
-$Id: LaTeX.pm,v 1.19 2004/12/30 01:40:44 timj Exp $
+$Id$
=end __PRIVATE__
diff --git a/Master/tlpkg/tlperl/lib/Pod/Man.pm b/Master/tlpkg/tlperl/lib/Pod/Man.pm
index 9339f835bbc..96f3fccee72 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Man.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Man.pm
@@ -1,7 +1,7 @@
# Pod::Man -- Convert POD data to formatted *roff input.
#
-# 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 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
@@ -31,11 +31,12 @@ use subs qw(makespace);
use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION);
use Carp qw(croak);
+use Encode qw(encode);
use Pod::Simple ();
@ISA = qw(Pod::Simple);
-$VERSION = '2.23';
+$VERSION = '2.25';
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
@@ -723,7 +724,11 @@ sub outindex {
# Output some text, without any additional changes.
sub output {
my ($self, @text) = @_;
- print { $$self{output_fh} } @text;
+ if ($$self{ENCODE}) {
+ print { $$self{output_fh} } encode ('UTF-8', join ('', @text));
+ } else {
+ print { $$self{output_fh} } @text;
+ }
}
##############################################################################
@@ -740,17 +745,19 @@ sub start_document {
return;
}
- # If we were given the utf8 option, set an output encoding on our file
- # handle. Wrap in an eval in case we're using a version of Perl too old
- # to understand this.
- #
- # This is evil because it changes the global state of a file handle that
- # we may not own. However, we can't just blindly encode all output, since
- # there may be a pre-applied output encoding (such as from PERL_UNICODE)
- # and then we would double-encode. This seems to be the least bad
- # approach.
+ # When UTF-8 output is set, check whether our output file handle already
+ # has a PerlIO encoding layer set. If it does not, we'll need to encode
+ # our output before printing it (handled in the output() sub). Wrap the
+ # check in an eval to handle versions of Perl without PerlIO.
+ $$self{ENCODE} = 0;
if ($$self{utf8}) {
- eval { binmode ($$self{output_fh}, ':encoding(UTF-8)') };
+ $$self{ENCODE} = 1;
+ eval {
+ my @layers = PerlIO::get_layers ($$self{output_fh});
+ if (grep { $_ eq 'utf8' } @layers) {
+ $$self{ENCODE} = 0;
+ }
+ }
}
# Determine information for the preamble and then output it.
@@ -949,8 +956,9 @@ sub cmd_para {
if defined ($line) && DEBUG && !$$self{IN_NAME};
# Force exactly one newline at the end and strip unwanted trailing
- # whitespace at the end.
- $text =~ s/\s*$/\n/;
+ # whitespace at the end, but leave "\ " backslashed space from an S< >
+ # at the end of a line.
+ $text =~ s/((?:\\ )*)\s*$/$1\n/;
# Output the paragraph.
$self->output ($self->protect ($self->textmapfonts ($text)));
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc.pm
index 654785a1f70..083a6e907e1 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.15_02';
+$VERSION = '3.15_04';
#..........................................................................
BEGIN { # Make a DEBUG constant very first thing...
@@ -499,7 +499,7 @@ sub find_good_formatter_class {
} else {
$^W = 0;
# The average user just has no reason to be seeing
- # $^W-suppressable warnings from the the require!
+ # $^W-suppressible warnings from the the require!
}
eval "require $c";
@@ -746,7 +746,7 @@ sub grand_search_init {
for ($i = 0; $trn = $ENV{'DCL$PATH;'.$i}; $i++) {
push(@searchdirs,$trn);
}
- push(@searchdirs,'perl_root:[lib.pod]') # installed pods
+ push(@searchdirs,'perl_root:[lib.pods]') # installed pods
}
else {
push(@searchdirs, grep(-d, split($Config{path_sep},
@@ -1128,7 +1128,7 @@ sub render_findings {
} else {
$^W = 0;
# The average user just has no reason to be seeing
- # $^W-suppressable warnings from the formatting!
+ # $^W-suppressible warnings from the formatting!
}
eval { $formatter->parse_from_file( $file, $out_fh ) };
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm
index 1562ec8bb3f..5b29fd996e5 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm
@@ -21,7 +21,7 @@ use Pod::Perldoc ();
use File::Spec::Functions qw(catfile);
use Tk;
-die join '', __PACKAGE__, " doesn't work nice with Tk.pm verison $Tk::VERSION"
+die join '', __PACKAGE__, " doesn't work nice with Tk.pm version $Tk::VERSION"
if $Tk::VERSION eq '800.003';
BEGIN { eval { require Tk::FcyEntry; }; };
diff --git a/Master/tlpkg/tlperl/lib/Pod/Plainer.pm b/Master/tlpkg/tlperl/lib/Pod/Plainer.pm
deleted file mode 100644
index d9e57bee1e6..00000000000
--- a/Master/tlpkg/tlperl/lib/Pod/Plainer.pm
+++ /dev/null
@@ -1,100 +0,0 @@
-package Pod::Plainer;
-use 5.006;
-use strict;
-use warnings;
-use if $] >= 5.011, 'deprecate';
-use Pod::Parser;
-our @ISA = qw(Pod::Parser);
-our $VERSION = '1.02';
-
-our %E = qw( < lt > gt );
-
-sub escape_ltgt {
- (undef, my $text) = @_;
- $text =~ s/([<>])/E<$E{$1}>/g;
- $text
-}
-
-sub simple_delimiters {
- (undef, my $seq) = @_;
- $seq -> left_delimiter( '<' );
- $seq -> right_delimiter( '>' );
- $seq;
-}
-
-sub textblock {
- my($parser,$text,$line) = @_;
- print {$parser->output_handle()}
- $parser->parse_text(
- { -expand_text => q(escape_ltgt),
- -expand_seq => q(simple_delimiters) },
- $text, $line ) -> raw_text();
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Pod::Plainer - Perl extension for converting Pod to old-style Pod.
-
-=head1 SYNOPSIS
-
- use Pod::Plainer;
-
- my $parser = Pod::Plainer -> new ();
- $parser -> parse_from_filehandle(\*STDIN);
-
-=head1 DESCRIPTION
-
-Pod::Plainer uses Pod::Parser which takes Pod with the (new)
-'CE<lt>E<lt> .. E<gt>E<gt>' constructs
-and returns the old(er) style with just 'CE<lt>E<gt>';
-'<' and '>' are replaced by 'EE<lt>ltE<gt>' and 'EE<lt>gtE<gt>'.
-
-This can be used to pre-process Pod before using tools which do not
-recognise the new style Pods.
-
-=head2 METHODS
-
-=over
-
-=item escape_ltgt
-
-Replace '<' and '>' by 'EE<lt>ltE<gt>' and 'EE<lt>gtE<gt>'.
-
-=item simple_delimiters
-
-Replace delimiters by 'E<lt>' and 'E<gt>'.
-
-=item textblock
-
-Redefine C<textblock> from L<Pod::Parser> to use C<escape_ltgt>
-and C<simple_delimiters>.
-
-=back
-
-=head2 EXPORT
-
-None by default.
-
-=head1 AUTHOR
-
-Robin Barker, rmbarker@cpan.org
-
-=head1 SEE ALSO
-
-See L<Pod::Parser>.
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (C) 2009 by Robin Barker
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.10.1 or,
-at your option, any later version of Perl 5 you may have available.
-
-=cut
-
-$Id: Plainer.pm 253 2010-02-11 16:28:10Z rmb1 $
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple.pm b/Master/tlpkg/tlperl/lib/Pod/Simple.pm
index 51f9a698019..909a2ec8341 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.14';
+$VERSION = '3.16';
@Known_formatting_codes = qw(I B C L E F S X Z);
%Known_formatting_codes = map(($_=>1), @Known_formatting_codes);
@@ -474,7 +474,7 @@ sub whine {
return $self->_complain_errata(@_);
}
-sub scream { # like whine, but not suppressable
+sub scream { # like whine, but not suppressible
#my($self,$line,$complaint) = @_;
my $self = shift(@_);
++$self->{'errors_seen'};
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/BlackBox.pm
index 9917898cff7..4765744d82c 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.14';
+$VERSION = '3.16';
#use constant DEBUG => 7;
BEGIN {
require Pod::Simple;
@@ -88,8 +88,8 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines)
DEBUG > 2 and print "First line: [$source_line]\n";
if( ($line = $source_line) =~ s/^\xEF\xBB\xBF//s ) {
- DEBUG and print "UTF-8 BOM seen. Faking a '=encode utf8'.\n";
- $self->_handle_encoding_line( "=encode utf8" );
+ DEBUG and print "UTF-8 BOM seen. Faking a '=encoding utf8'.\n";
+ $self->_handle_encoding_line( "=encoding utf8" );
$line =~ tr/\n\r//d;
} elsif( $line =~ s/^\xFE\xFF//s ) {
@@ -519,7 +519,7 @@ sub _ponder_paragraph_buffer {
# don't require any lookahead, but all others (bullets
# and numbers) do.
-# TODO: winge about many kinds of directives in non-resolving =for regions?
+# TODO: whinge about many kinds of directives in non-resolving =for regions?
# TODO: many? like what? =head1 etc?
$para = shift @$paras;
@@ -1911,7 +1911,7 @@ sub pretty { # adopted from Class::Classless
# A rather unsubtle method of blowing away all the state information
# from a parser object so it can be reused. Provided as a utility for
-# backward compatibilty in Pod::Man, etc. but not recommended for
+# backward compatibility in Pod::Man, etc. but not recommended for
# general use.
sub reinit {
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Checker.pm
index 26a60237236..6aca3894191 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.14';
+$VERSION = '3.16';
@ISA = ('Pod::Simple::Methody');
BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG)
? \&Pod::Simple::DEBUG
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Debug.pm
index 1349be32cb6..b3de557af3f 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.14';
+$VERSION = '3.16';
sub import {
my($value,$variable);
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsText.pm
index 91554341e35..5609c71e342 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.14';
+$VERSION = '3.16';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm
index d83f8d33f55..beef7caad8a 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/DumpAsXML.pm
@@ -1,7 +1,7 @@
require 5;
package Pod::Simple::DumpAsXML;
-$VERSION = '3.14';
+$VERSION = '3.16';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
@@ -114,7 +114,7 @@ L<Pod::Simple>.
L<Pod::Simple::XMLOutStream> is rather like this class.
Pod::Simple::XMLOutStream's output is space-padded in a way
that's better for sending to an XML processor (that is, it has
-no ignoreable whitespace). But
+no ignorable whitespace). But
Pod::Simple::DumpAsXML's output is much more human-readable, being
(more-or-less) one token per line, with line-wrapping.
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/HTML.pm
index b1a75cb4e39..9d7d069645a 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.14';
+$VERSION = '3.16';
BEGIN {
if(defined &DEBUG) { } # no-op
@@ -81,7 +81,7 @@ __PACKAGE__->_accessorize(
# out of apparently longstanding habit)
'html_css', # URL of CSS file to point to
- 'html_javascript', # URL of CSS file to point to
+ 'html_javascript', # URL of Javascript file to point to
'force_title', # should already be &-escaped
'default_title', # should already be &-escaped
@@ -685,6 +685,8 @@ sub section_escape {
sub section_name_tidy {
my($self, $section) = @_;
+ $section =~ s/^\s+//;
+ $section =~ s/\s+$//;
$section =~ tr/ /_/;
$section =~ tr/\x00-\x1F\x80-\x9F//d if 'A' eq chr(65); # drop crazy characters
$section = $self->unicode_escape_url($section);
@@ -897,25 +899,176 @@ TODO
=head1 CALLING FROM PERL
-TODO make a new object, set any options, and use parse_from_file
+=head2 Minimal code
+ use Pod::Simple::HTML;
+ my $p = Pod::Simple::HTML->new;
+ $p->output_string(\my $html);
+ $p->parse_file('path/to/Module/Name.pm');
+ open my $out, '>', 'out.html' or die "Cannot open 'out.html': $!\n";
+ print $out $html;
+
+=head2 More detailed example
+
+ use Pod::Simple::HTML;
+
+Set the content type:
+
+ $Pod::Simple::HTML::Content_decl = q{<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >};
+
+ my $p = Pod::Simple::HTML->new;
+
+Include a single javascript source:
+
+ $p->html_javascript('http://abc.com/a.js');
+
+Or insert multiple javascript source in the header
+(or for that matter include anything, thought this is not recommended)
+
+ $p->html_javascript('
+ <script type="text/javascript" src="http://abc.com/b.js"></script>
+ <script type="text/javascript" src="http://abc.com/c.js"></script>');
+
+Include a single css source in the header:
+
+ $p->html_css('/style.css');
+
+or insert multiple css sources:
+
+ $p->html_css('
+ <link rel="stylesheet" type="text/css" title="pod_stylesheet" href="http://remote.server.com/jquery.css">
+ <link rel="stylesheet" type="text/css" title="pod_stylesheet" href="/style.css">');
+
+Tell the parser where should the output go. In this case it will be placed in the $html variable:
+
+ my $html;
+ $p->output_string(\$html);
+
+Parse and process a file with pod in it:
+
+ $p->parse_file('path/to/Module/Name.pm');
=head1 METHODS
TODO
all (most?) accessorized methods
+The following variables need to be set B<before> the call to the ->new constructor.
+
+Set the string that is included before the opening <html> tag:
+
+ $Pod::Simple::HTML::Doctype_decl = qq{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">\n};
+
+Set the content-type in the HTML head: (defaults to ISO-8859-1)
+
+ $Pod::Simple::HTML::Content_decl = q{<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >};
+
+Set the value that will be ebedded in the opening tags of F, C tags and verbatim text.
+F maps to <em>, C maps to <code>, Verbatim text maps to <pre> (Computerese defaults to "")
+
+ $Pod::Simple::HTML::Computerese = ' class="some_class_name';
+
+=head2 html_css
+
+=head2 html_javascript
+
+=head2 title_prefix
+
+=head2 title_postfix
+
+=head2 html_header_before_title
+
+This includes everything before the <title> opening tag including the Document type
+and including the opening <title> tag. The following call will set it to be a simple HTML
+file:
+
+ $p->html_header_before_title('<html><head><title>');
+
+=head2 html_h_level
+
+Normally =head1 will become <h1>, =head2 will become <h2> etc.
+Using the html_h_level method will change these levels setting the h level
+of =head1 tags:
+
+ $p->html_h_level(3);
+
+Will make sure that =head1 will become <h3> and =head2 will become <h4> etc...
+
+
+=head2 index
+
+Set it to some true value if you want to have an index (in reality a table of contents)
+to be added at the top of the generated HTML.
+
+ $p->index(1);
+
+=head2 html_header_after_title
+
+Includes the closing tag of </title> and through the rest of the head
+till the opening of the body
+
+ $p->html_header_after_title('</title>...</head><body id="my_id">');
+
+=head2 html_footer
+
+The very end of the document:
+
+ $p->html_footer( qq[\n<!-- end doc -->\n\n</body></html>\n] );
=head1 SUBCLASSING
-TODO
+Can use any of the methods described above but for further customization
+one needs to override some of the methods:
+
+ package My::Pod;
+ use strict;
+ use warnings;
+
+ use base 'Pod::Simple::HTML';
+
+ # needs to return a URL string such
+ # http://some.other.com/page.html
+ # #anchor_in_the_same_file
+ # /internal/ref.html
+ sub do_pod_link {
+ # My::Pod object and Pod::Simple::PullParserStartToken object
+ my ($self, $link) = @_;
+
+ say $link->tagname; # will be L for links
+ say $link->attr('to'); #
+ say $link->attr('type'); # will be 'pod' always
+ say $link->attr('section');
+
+ # Links local to our web site
+ if ($link->tagname eq 'L' and $link->attr('type') eq 'pod') {
+ my $to = $link->attr('to');
+ if ($to =~ /^Padre::/) {
+ $to =~ s{::}{/}g;
+ return "/docs/Padre/$to.html";
+ }
+ }
- can just set any of: html_css html_javascript title_prefix
- 'html_header_before_title',
- 'html_header_after_title',
- 'html_footer',
+ # all other links are generated by the parent class
+ my $ret = $self->SUPER::do_pod_link($link);
+ return $ret;
+ }
-maybe override do_pod_link
+ 1;
+
+Meanwhile in script.pl:
+
+ use My::Pod;
+
+ my $p = My::Pod->new;
+
+ my $html;
+ $p->output_string(\$html);
+ $p->parse_file('path/to/Module/Name.pm');
+ open my $out, '>', 'out.html' or die;
+ print $out $html;
+
+TODO
maybe override do_beginning do_end
@@ -952,7 +1105,7 @@ merchantability or fitness for a particular purpose.
=head1 ACKNOWLEDGEMENTS
-Thanks to L<Hurricane Electrict|http://he.net/> for permission to use its
+Thanks to L<Hurricane Electric|http://he.net/> for permission to use its
L<Linux man pages online|http://man.he.net/> site for man page links.
Thanks to L<search.cpan.org|http://search.cpan.org/> for permission to use the
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/HTMLBatch.pm
index 227c23b7f9f..7686cd41477 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.14';
+$VERSION = '3.16';
@ISA = (); # Yup, we're NOT a subclass of Pod::Simple::HTML!
# TODO: nocontents stylesheets. Strike some of the color variations?
@@ -726,7 +726,7 @@ sub _gen_css_wad {
'whtgrng', # white_with_green_on_grey
'grygrnw', # grey_with_green_on_white
) {
- my $outname = "$variation\_";
+ my $outname = $variation;
my $this_css = join "\n",
"/* This file is autogenerated. Do not edit. $outname */\n",
"\@import url(\"./_$variation.css\");",
@@ -735,7 +735,7 @@ sub _gen_css_wad {
;
my $name = $outname;
$name =~ tr/-_/ /;
- $self->add_css( "$outname.css", 0, $name, 0, 0, \$this_css);
+ $self->add_css( "_$outname.css", 0, $name, 0, 0, \$this_css);
}
return;
@@ -1141,7 +1141,7 @@ directory:
=item $batchconv->batch_convert( 'somedir:someother:also' , ...);
-This specifies that you want the dirs "somedir", "somother", and "also"
+This specifies that you want the dirs "somedir", "someother", and "also"
scanned, just as if you'd passed the arrayref
C<[qw( somedir someother also)]>. Note that a ":"-separator is normal
under Unix, but Under MSWin, you'll need C<'somedir;someother;also'>
@@ -1226,7 +1226,7 @@ If you set this to a false value, no contents file will be written.
This specifies what string should be put at the beginning of
the contents page.
The default is a string more or less like this:
-
+
<html>
<head><title>Perl Documentation</title></head>
<body class='contentspage'>
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/LinkSection.pm
index e426b2c547f..7d77ebb1f82 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.14';
+$VERSION = '3.16';
use strict;
use Pod::Simple::BlackBox;
use vars qw($VERSION );
-$VERSION = '3.14';
+$VERSION = '3.16';
use overload( # So it'll stringify nice
'""' => \&Pod::Simple::BlackBox::stringify_lol,
@@ -114,7 +114,7 @@ Output:
], 'Pod::Simple::LinkSection' ),
'baz'
], 'Pod::Simple::LinkSection' );
-
+
But stringify it and you get just the text content:
% perl -MData::Dumper -e
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Methody.pm
index bed3e8662b2..0d69b7a1d99 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.14';
+$VERSION = '3.16';
@ISA = ('Pod::Simple');
# Yes, we could use named variables, but I want this to be impose
@@ -51,12 +51,12 @@ Pod::Simple::Methody -- turn Pod::Simple events into method calls
use strict;
package SomePodFormatter;
use base qw(Pod::Simple::Methody);
-
+
sub handle_text {
my($self, $text) = @_;
...
}
-
+
sub start_head1 {
my($self, $attrs) = @_;
...
@@ -65,7 +65,7 @@ Pod::Simple::Methody -- turn Pod::Simple events into method calls
my($self) = @_;
...
}
-
+
...and start_/end_ methods for whatever other events you want to catch.
=head1 DESCRIPTION
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Progress.pm
index 7de46d5696b..622909bb2b1 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.14';
+$VERSION = '3.16';
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 c27d0cbeb0e..4033213e825 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.14';
+$VERSION = '3.16';
use Pod::Simple ();
BEGIN {@ISA = ('Pod::Simple')}
@@ -453,7 +453,7 @@ sub _get_titled_section {
$self->unget_token(@to_unget);
if(DEBUG) {
- if(defined $title) { print " Returing title <$title>\n" }
+ if(defined $title) { print " Returning title <$title>\n" }
else { print "Returning title <>\n" }
}
@@ -532,7 +532,7 @@ And elsewhere:
package SomePodProcessor;
use strict;
use base qw(Pod::Simple::PullParser);
-
+
sub run {
my $self = shift;
Token:
@@ -623,14 +623,14 @@ process the token-stream from the beginning.
For example, suppose you have a document that starts out:
=head1 NAME
-
+
Hoo::Boy::Wowza -- Stuff B<wow> yeah!
$parser->get_title on that document will return "Hoo::Boy::Wowza --
Stuff wow yeah!". If the document starts with:
=head1 Name
-
+
Hoo::Boy::W00t -- Stuff B<w00t> yeah!
Then you'll need to pass the C<nocase> option in order to recognize "Name":
@@ -648,7 +648,7 @@ the title seems to be of the form "SomeModuleName -- description".
For example, suppose you have a document that starts out:
=head1 NAME
-
+
Hoo::Boy::Wowza -- Stuff B<wow> yeah!
then $parser->get_short_title on that document will return
@@ -657,14 +657,14 @@ then $parser->get_short_title on that document will return
But if the document starts out:
=head1 NAME
-
+
Hooboy, stuff B<wow> yeah!
then $parser->get_short_title on that document will return "Hooboy,
stuff wow yeah!". If the document starts with:
=head1 Name
-
+
Hoo::Boy::W00t -- Stuff B<w00t> yeah!
Then you'll need to pass the C<nocase> option in order to recognize "Name":
@@ -769,6 +769,7 @@ Pod::Simple is maintained by:
=back
=cut
+
JUNK:
sub _old_get_title { # some witchery in here
@@ -833,7 +834,7 @@ sub _old_get_title { # some witchery in here
$self->unget_token(@to_unget);
if(DEBUG) {
- if(defined $title) { print " Returing title <$title>\n" }
+ if(defined $title) { print " Returning title <$title>\n" }
else { print "Returning title <>\n" }
}
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserEndToken.pm
index 67a625d8877..8b12e646dcc 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.14';
+$VERSION = '3.16';
sub new { # Class->new(tagname);
my $class = shift;
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserStartToken.pm
index 37d68ef6196..232ef235f38 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.14';
+$VERSION = '3.16';
sub new { # Class->new(tagname, optional_attrhash);
my $class = shift;
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserTextToken.pm
index ed6340d598a..a7fcb0fbb16 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.14';
+$VERSION = '3.16';
sub new { # Class->new(text);
my $class = shift;
@@ -61,14 +61,14 @@ as calling $token->text would do.
Or, if you want to alter the value, you can even do things like this:
for ( ${ $token->text_r } ) { # Aliases it with $_ !!
-
+
s/ The / the /g; # just for example
-
+
if( 'A' eq chr(65) ) { # (if in an ASCII world)
tr/\xA0/ /;
tr/\xAD//d;
}
-
+
...or however you want to alter the value...
}
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/PullParserToken.pm
index 2234ccf7ade..ad6ebf38b44 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.14';
+$VERSION = '3.16';
use strict;
sub new { # Class->new('type', stuff...); ## Overridden in derived classes anyway
@@ -56,10 +56,10 @@ Given a $parser that's an object of class Pod::Simple::PullParser
} elsif($token->is_text) {
...access $token->text, $token->text_r, etc...
-
+
} elsif($token->is_end) {
...access $token->tagname...
-
+
}
}
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/RTF.pm
index f476d37b249..7dbc643de52 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.14';
+$VERSION = '3.16';
use Pod::Simple::PullParser ();
BEGIN {@ISA = ('Pod::Simple::PullParser')}
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Search.pm
index 762701aa9cc..b7d209b1031 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.14'; ## Current version of this package
+$VERSION = '3.16'; ## Current version of this package
BEGIN { *DEBUG = sub () {0} unless defined &DEBUG; } # set DEBUG level
use Carp ();
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/SimpleTree.pm
index 32db4b6a51d..fc8b7a2a12a 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.14';
+$VERSION = '3.16';
BEGIN {
@ISA = ('Pod::Simple');
*DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG;
@@ -67,15 +67,15 @@ Pod::Simple::SimpleTree -- parse Pod into a simple parse tree
=head1 SYNOPSIS
% cat ptest.pod
-
+
=head1 PIE
-
+
I like B<pie>!
-
+
% perl -MPod::Simple::SimpleTree -MData::Dumper -e \
"print Dumper(Pod::Simple::SimpleTree->new->parse_file(shift)->root)" \
ptest.pod
-
+
$VAR1 = [
'Document',
{ 'start_line' => 1 },
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Subclassing.pod b/Master/tlpkg/tlperl/lib/Pod/Simple/Subclassing.pod
index f2011d5a5ce..f5363183155 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/Subclassing.pod
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/Subclassing.pod
@@ -275,7 +275,7 @@ some link text.)
For example, this Pod source:
L<hell itself!|crontab(5)>
-
+
will produce this event structure:
<L to="crontab(5)" type="man">
@@ -425,7 +425,7 @@ names in the event structure.
=item events with an element_name of over-bullet
When an "=over ... Z<>=back" block is parsed where the items are
-a bulletted list, it will produce this event structure:
+a bulleted list, it will produce this event structure:
<over-bullet indent="4" start_line="543">
<item-bullet start_line="545">
@@ -509,15 +509,15 @@ The I<indent> attribute is as with the other over-* events.
For example, this Pod source:
=over
-
+
=item Foo
-
+
Stuff
-
+
=item Bar I<baz>!
-
+
Quux
-
+
=back
produces this event structure:
@@ -559,18 +559,18 @@ The I<indent> attribute is as with the other over-* events.
For example, this Pod source:
=over
-
+
For cutting off our trade with all parts of the world
-
+
For transporting us beyond seas to be tried for pretended offenses
-
+
He is at this time transporting large armies of foreign mercenaries to
complete the works of death, desolation and tyranny, already begun with
circumstances of cruelty and perfidy scarcely paralleled in the most
barbarous ages, and totally unworthy the head of a civilized nation.
-
+
=cut
-
+
will produce this event structure:
<over-block indent="4" start_line="2">
@@ -615,7 +615,7 @@ Pod::Simple provides a lot of methods that aren't generally interesting
to the end user of an existing Pod formatter, but some of which you
might find useful in writing a Pod formatter. They are listed below. The
first several methods (the accept_* methods) are for declaring the
-capabilites of your parser, notably what C<=for I<targetname>> sections
+capabilities of your parser, notably what C<=for I<targetname>> sections
it's interested in, what extra NE<lt>...E<gt> codes it accepts beyond
the ones described in the I<perlpod>.
@@ -793,7 +793,7 @@ C<complain_stderr>.
=item C<< $parser->scream( I<linenumber>, I<complaint string> ) >>
This notes an error like C<whine> does, except that it is not
-suppressable with C<no_whining>. This should be used only for very
+suppressible with C<no_whining>. This should be used only for very
serious errors.
@@ -806,7 +806,7 @@ C<die>!
=item C<< $parser->hide_line_numbers( I<SOMEVALUE> ) >>
-Some subclasses that indescriminately dump event attributes (well,
+Some subclasses that indiscriminately dump event attributes (well,
except for ones beginning with "~") can use this object attribute for
refraining to dump the "start_line" attribute.
@@ -887,6 +887,8 @@ L<Pod::Simple::Text> -- a simple plaintext formatter for Pod
L<Pod::Simple::TextContent> -- like Pod::Simple::Text, but
makes no effort for indent or wrap the text being formatted
+L<Pod::Simple::HTML> -- a simple HTML formatter for Pod
+
L<perlpod|perlpod>
L<perlpodspec|perlpodspec>
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Text.pm
index 81fde4e7a70..55dae9a6dbe 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.14';
+$VERSION = '3.16';
@ISA = ('Pod::Simple::Methody');
BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG)
? \&Pod::Simple::DEBUG
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/TextContent.pm
index 914c7fd166c..36a4988cf12 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.14';
+$VERSION = '3.16';
@ISA = ('Pod::Simple');
sub new {
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/TiedOutFH.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/TiedOutFH.pm
index c5d4483b283..e6e5a4a058f 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.14';
+$VERSION = '3.16';
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/Transcode.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/Transcode.pm
index 258d0d76760..dec3b967b39 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.14';
+$VERSION = '3.16';
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 d1c320d5d1a..647447503ed 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.14';
+$VERSION = '3.16';
# 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 bab59fc8972..5c10f02ced2 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.14';
+$VERSION = '3.16';
sub is_dumb {0}
sub is_smart {1}
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm
index 6a8fb7e97e4..ef05ddb6ea5 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Simple/XHTML.pm
@@ -23,13 +23,29 @@ This is a subclass of L<Pod::Simple::Methody> and inherits all its
methods. The implementation is entirely different than
L<Pod::Simple::HTML>, but it largely preserves the same interface.
+=head2 Minimal code
+
+ use Pod::Simple::XHTML;
+ my $psx = Pod::Simple::XHTML->new;
+ $psx->output_string(\my $html);
+ $psx->parse_file('path/to/Module/Name.pm');
+ open my $out, '>', 'out.html' or die "Cannot open 'out.html': $!\n";
+ print $out $html;
+
+You can also control the character encoding and entities. For example, if
+you're sure that the POD is properly encoded (using the C<=encoding> command),
+you can prevent high-bit characters from being encoded as HTML entities and
+declare the output character set as UTF-8 before parsing, like so:
+
+ $psx->html_charset('UTF-8');
+ $psx->html_encode_chars('&<>">');
+
=cut
package Pod::Simple::XHTML;
use strict;
use vars qw( $VERSION @ISA $HAS_HTML_ENTITIES );
-$VERSION = '3.14';
-use Carp ();
+$VERSION = '3.16';
use Pod::Simple::Methody ();
@ISA = ('Pod::Simple::Methody');
@@ -46,10 +62,17 @@ my %entities = (
);
sub encode_entities {
- return HTML::Entities::encode_entities( $_[0] ) if $HAS_HTML_ENTITIES;
+ my $self = shift;
+ my $ents = $self->html_encode_chars;
+ return HTML::Entities::encode_entities( $_[0], $ents ) if $HAS_HTML_ENTITIES;
+ if (defined $ents) {
+ $ents =~ s,(?<!\\)([]/]),\\$1,g;
+ $ents =~ s,(?<!\\)\\\z,\\\\,;
+ } else {
+ $ents = join '', keys %entities;
+ }
my $str = $_[0];
- my $ents = join '', keys %entities;
- $str =~ s/([$ents])/'&' . $entities{$1} . ';'/ge;
+ $str =~ s/([$ents])/'&' . ($entities{$1} || sprintf '#x%X', ord $1) . ';'/ge;
return $str;
}
@@ -107,6 +130,12 @@ not set by default.
A document type tag for the file. This option is not set by default.
+=head2 html_charset
+
+The charater set to declare in the Content-Type meta tag created by default
+for C<html_header_tags>. Note that this option will be ignored if the value of
+C<html_header_tags> is changed. Defaults to "ISO-8859-1".
+
=head2 html_header_tags
Additional arbitrary HTML tags for the header of the document. The
@@ -117,6 +146,15 @@ default value is just a content type header tag:
Add additional meta tags here, or blocks of inline CSS or JavaScript
(wrapped in the appropriate tags).
+=head3 html_encode_chars
+
+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
+L<HTML::Entities> is not installed, then any characters other than C<&<>"'>
+will be encoded numerically.
+
=head2 html_h_level
This is the level of HTML "Hn" element to which a Pod "head1" corresponds. For
@@ -165,10 +203,11 @@ __PACKAGE__->_accessorize(
'man_url_prefix',
'man_url_postfix',
'title_prefix', 'title_postfix',
- 'html_css',
+ 'html_css',
'html_javascript',
'html_doctype',
- 'html_header_tags',
+ 'html_charset',
+ 'html_encode_chars',
'html_h_level',
'title', # Used internally for the title extracted from the content
'default_title',
@@ -198,7 +237,7 @@ sub new {
$new->{'output_fh'} ||= *STDOUT{IO};
$new->perldoc_url_prefix('http://search.cpan.org/perldoc?');
$new->man_url_prefix('http://man.he.net/man');
- $new->html_header_tags('<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />');
+ $new->html_charset('ISO-8859-1');
$new->nix_X_codes(1);
$new->codes_in_verbatim(1);
$new->{'scratch'} = '';
@@ -206,6 +245,7 @@ sub new {
$new->{'output'} = [];
$new->{'saved'} = [];
$new->{'ids'} = {};
+ $new->{'in_li'} = [];
$new->{'__region_targets'} = [];
$new->{'__literal_targets'} = {};
@@ -214,6 +254,14 @@ sub new {
return $new;
}
+sub html_header_tags {
+ my $self = shift;
+ return $self->{html_header_tags} = shift if @_;
+ return $self->{html_header_tags}
+ ||= '<meta http-equiv="Content-Type" content="text/html; charset='
+ . $self->html_charset . '" />';
+}
+
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=head2 handle_text
@@ -270,7 +318,7 @@ sub handle_text {
# escape special characters in HTML (<, >, &, etc)
$_[0]{'scratch'} .= $_[0]->__in_literal_xhtml_region
? $_[1]
- : encode_entities( $_[1] );
+ : $_[0]->encode_entities( $_[1] );
}
sub start_Para { $_[0]{'scratch'} = '<p>' }
@@ -282,15 +330,15 @@ sub start_head3 { $_[0]{'in_head'} = 3 }
sub start_head4 { $_[0]{'in_head'} = 4 }
sub start_item_number {
- $_[0]{'scratch'} = "</li>\n" if $_[0]{'in_li'};
+ $_[0]{'scratch'} = "</li>\n" if ($_[0]{'in_li'}->[-1] && pop @{$_[0]{'in_li'}});
$_[0]{'scratch'} .= '<li><p>';
- $_[0]{'in_li'} = 1
+ push @{$_[0]{'in_li'}}, 1;
}
sub start_item_bullet {
- $_[0]{'scratch'} = "</li>\n" if $_[0]{'in_li'};
+ $_[0]{'scratch'} = "</li>\n" if ($_[0]{'in_li'}->[-1] && pop @{$_[0]{'in_li'}});
$_[0]{'scratch'} .= '<li><p>';
- $_[0]{'in_li'} = 1
+ push @{$_[0]{'in_li'}}, 1;
}
sub start_item_text {
@@ -301,9 +349,9 @@ sub start_item_text {
$_[0]{'scratch'} .= '<dt>';
}
-sub start_over_bullet { $_[0]{'scratch'} = '<ul>'; $_[0]->emit }
+sub start_over_bullet { $_[0]{'scratch'} = '<ul>'; push @{$_[0]{'in_li'}}, 0; $_[0]->emit }
sub start_over_block { $_[0]{'scratch'} = '<ul>'; $_[0]->emit }
-sub start_over_number { $_[0]{'scratch'} = '<ol>'; $_[0]->emit }
+sub start_over_number { $_[0]{'scratch'} = '<ol>'; push @{$_[0]{'in_li'}}, 0; $_[0]->emit }
sub start_over_text {
$_[0]{'scratch'} = '<dl>';
$_[0]{'dl_level'}++;
@@ -314,14 +362,16 @@ sub start_over_text {
sub end_over_block { $_[0]{'scratch'} .= '</ul>'; $_[0]->emit }
sub end_over_number {
- $_[0]{'scratch'} = "</li>\n" if delete $_[0]{'in_li'};
+ $_[0]{'scratch'} = "</li>\n" if ( pop @{$_[0]{'in_li'}} );
$_[0]{'scratch'} .= '</ol>';
+ pop @{$_[0]{'in_li'}};
$_[0]->emit;
}
sub end_over_bullet {
- $_[0]{'scratch'} = "</li>\n" if delete $_[0]{'in_li'};
+ $_[0]{'scratch'} = "</li>\n" if ( pop @{$_[0]{'in_li'}} );
$_[0]{'scratch'} .= '</ul>';
+ pop @{$_[0]{'in_li'}};
$_[0]->emit;
}
@@ -372,7 +422,7 @@ sub end_item_text {
}
# This handles =begin and =for blocks of all kinds.
-sub start_for {
+sub start_for {
my ($self, $flags) = @_;
push @{ $self->{__region_targets} }, $flags->{target_matching};
@@ -386,7 +436,7 @@ sub start_for {
$self->emit;
}
-sub end_for {
+sub end_for {
my ($self) = @_;
$self->{'scratch'} .= '</div>' unless $self->__in_literal_xhtml_region;
@@ -395,7 +445,7 @@ sub end_for {
$self->emit;
}
-sub start_Document {
+sub start_Document {
my ($self) = @_;
if (defined $self->html_header) {
$self->{'scratch'} .= $self->html_header;
@@ -407,7 +457,7 @@ sub start_Document {
$metatags = $self->html_header_tags || '';
if ($self->html_css) {
$metatags .= "\n<link rel='stylesheet' href='" .
- $self->html_css . "' type='text/css'>";
+ $self->html_css . "' type='text/css' />";
}
if ($self->html_javascript) {
$metatags .= "\n<script type='text/javascript' src='" .
@@ -500,10 +550,12 @@ sub end_I { $_[0]{'scratch'} .= '</i>' }
sub start_L {
my ($self, $flags) = @_;
my ($type, $to, $section) = @{$flags}{'type', 'to', 'section'};
- my $url = $type eq 'url' ? $to
+ my $url = $self->encode_entities(
+ $type eq 'url' ? $to
: $type eq 'pod' ? $self->resolve_pod_page_link($to, $section)
: $type eq 'man' ? $self->resolve_man_page_link($to, $section)
- : undef;
+ : undef
+ );
# If it's an unknown type, use an attribute-less <a> like HTML.pm.
$self->{'scratch'} .= '<a' . ($url ? ' href="'. $url . '">' : '>');
@@ -511,8 +563,8 @@ sub start_L {
sub end_L { $_[0]{'scratch'} .= '</a>' }
-sub start_S { $_[0]{'scratch'} .= '<nobr>' }
-sub end_S { $_[0]{'scratch'} .= '</nobr>' }
+sub start_S { $_[0]{'scratch'} .= '<span style="white-space: nowrap;">' }
+sub end_S { $_[0]{'scratch'} .= '</span>' }
sub emit {
my($self) = @_;
@@ -554,7 +606,7 @@ sub resolve_pod_page_link {
}
return ($self->perldoc_url_prefix || '')
- . encode_entities($to) . $section
+ . $self->encode_entities($to) . $section
. ($self->perldoc_url_postfix || '');
}
@@ -583,7 +635,7 @@ sub resolve_man_page_link {
my ($page, $part) = $to =~ /^([^(]+)(?:[(](\d+)[)])?$/;
return undef unless $page;
return ($self->man_url_prefix || '')
- . ($part || 1) . "/" . encode_entities($page)
+ . ($part || 1) . "/" . $self->encode_entities($page)
. ($self->man_url_postfix || '');
}
@@ -627,6 +679,7 @@ sub idify {
for ($t) {
s/<[^>]+>//g; # Strip HTML.
s/&[^;]+;//g; # Strip entities.
+ s/^\s+//; s/\s+$//; # Strip white space.
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.
@@ -689,7 +742,7 @@ merchantability or fitness for a particular purpose.
=head1 ACKNOWLEDGEMENTS
-Thanks to L<Hurricane Electrict|http://he.net/> for permission to use its
+Thanks to L<Hurricane Electric|http://he.net/> for permission to use its
L<Linux man pages online|http://man.he.net/> site for man page links.
Thanks to L<search.cpan.org|http://search.cpan.org/> for permission to use the
diff --git a/Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm b/Master/tlpkg/tlperl/lib/Pod/Simple/XMLOutStream.pm
index 2e6b42834e0..69b992d01ec 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.14';
+$VERSION = '3.16';
BEGIN {
@ISA = ('Pod::Simple');
*DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG;
diff --git a/Master/tlpkg/tlperl/lib/Pod/Text.pm b/Master/tlpkg/tlperl/lib/Pod/Text.pm
index c68313c3898..cc028206606 100644
--- a/Master/tlpkg/tlperl/lib/Pod/Text.pm
+++ b/Master/tlpkg/tlperl/lib/Pod/Text.pm
@@ -29,6 +29,7 @@ use strict;
use vars qw(@ISA @EXPORT %ESCAPES $VERSION);
use Carp qw(carp croak);
+use Encode qw(encode);
use Exporter ();
use Pod::Simple ();
@@ -37,7 +38,7 @@ use Pod::Simple ();
# We have to export pod2text for backward compatibility.
@EXPORT = qw(pod2text);
-$VERSION = '3.14';
+$VERSION = '3.15';
##############################################################################
# Initialization
@@ -250,7 +251,8 @@ sub reformat {
# necessary to match the input encoding unless UTF-8 output is forced. This
# preserves the traditional pass-through behavior of Pod::Text.
sub output {
- my ($self, $text) = @_;
+ my ($self, @text) = @_;
+ my $text = join ('', @text);
$text =~ tr/\240\255/ /d;
unless ($$self{opt_utf8} || $$self{CHECKED_ENCODING}) {
my $encoding = $$self{encoding} || '';
@@ -259,7 +261,11 @@ sub output {
}
$$self{CHECKED_ENCODING} = 1;
}
- print { $$self{output_fh} } $text;
+ if ($$self{ENCODE}) {
+ print { $$self{output_fh} } encode ('UTF-8', $text);
+ } else {
+ print { $$self{output_fh} } $text;
+ }
}
# Output a block of code (something that isn't part of the POD text). Called
@@ -284,17 +290,19 @@ sub start_document {
# We have to redo encoding handling for each document.
delete $$self{CHECKED_ENCODING};
- # If we were given the utf8 option, set an output encoding on our file
- # handle. Wrap in an eval in case we're using a version of Perl too old
- # to understand this.
- #
- # This is evil because it changes the global state of a file handle that
- # we may not own. However, we can't just blindly encode all output, since
- # there may be a pre-applied output encoding (such as from PERL_UNICODE)
- # and then we would double-encode. This seems to be the least bad
- # approach.
+ # When UTF-8 output is set, check whether our output file handle already
+ # has a PerlIO encoding layer set. If it does not, we'll need to encode
+ # our output before printing it (handled in the output() sub). Wrap the
+ # check in an eval to handle versions of Perl without PerlIO.
+ $$self{ENCODE} = 0;
if ($$self{opt_utf8}) {
- eval { binmode ($$self{output_fh}, ':encoding(UTF-8)') };
+ $$self{ENCODE} = 1;
+ eval {
+ my @layers = PerlIO::get_layers ($$self{output_fh});
+ if (grep { $_ eq 'utf8' } @layers) {
+ $$self{ENCODE} = 0;
+ }
+ };
}
return '';