summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2008-06-05 12:56:53 +0000
committerSteve Peters <steve@fisharerojo.org>2008-06-05 12:56:53 +0000
commit8737ae4deeb0953ae3b76fcc430072d0e030997c (patch)
treec5102e8229cedf079ab80a2b36e23dd74f69e916 /lib/Pod
parent8365c870bf83de09c3b5aafe1d865e0243eea1dc (diff)
downloadperl-8737ae4deeb0953ae3b76fcc430072d0e030997c.tar.gz
Upgrade to Pod-Simple-3.07
p4raw-id: //depot/perl@34000
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/Simple.pm2
-rw-r--r--lib/Pod/Simple/XHTML.pm22
-rw-r--r--lib/Pod/Simple/t/xhtml01.t12
3 files changed, 30 insertions, 6 deletions
diff --git a/lib/Pod/Simple.pm b/lib/Pod/Simple.pm
index 0b26a2fbaa..1e325724a5 100644
--- a/lib/Pod/Simple.pm
+++ b/lib/Pod/Simple.pm
@@ -18,7 +18,7 @@ use vars qw(
);
@ISA = ('Pod::Simple::BlackBox');
-$VERSION = '3.06';
+$VERSION = '3.07';
@Known_formatting_codes = qw(I B C L E F S X Z);
%Known_formatting_codes = map(($_=>1), @Known_formatting_codes);
diff --git a/lib/Pod/Simple/XHTML.pm b/lib/Pod/Simple/XHTML.pm
index 05c25daf71..d130faaa96 100644
--- a/lib/Pod/Simple/XHTML.pm
+++ b/lib/Pod/Simple/XHTML.pm
@@ -27,13 +27,31 @@ L<Pod::Simple::HTML>, but it largely preserves the same interface.
package Pod::Simple::XHTML;
use strict;
-use vars qw( $VERSION @ISA );
+use vars qw( $VERSION @ISA $HAS_HTML_ENTITIES );
$VERSION = '3.04';
use Carp ();
use Pod::Simple::Methody ();
@ISA = ('Pod::Simple::Methody');
-use HTML::Entities 'encode_entities';
+BEGIN {
+ $HAS_HTML_ENTITIES = eval "require HTML::Entities; 1";
+}
+
+my %entities = (
+ q{>} => 'gt',
+ q{<} => 'lt',
+ q{'} => '#39',
+ q{"} => 'quot',
+ q{&} => 'amp',
+);
+
+sub encode_entities {
+ return HTML::Entities::encode_entities( $_[0] ) if $HAS_HTML_ENTITIES;
+ my $str = $_[0];
+ my $ents = join '', keys %entities;
+ $str =~ s/([$ents])/'&' . $entities{$1} . ';'/ge;
+ return $str;
+}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/Pod/Simple/t/xhtml01.t b/lib/Pod/Simple/t/xhtml01.t
index 37e295c411..d75605a1ea 100644
--- a/lib/Pod/Simple/t/xhtml01.t
+++ b/lib/Pod/Simple/t/xhtml01.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use lib '../lib';
-use Test::More tests => 25;
+use Test::More tests => 26;
use_ok('Pod::Simple::XHTML') or exit;
@@ -318,8 +318,13 @@ is($results, <<"EOHTML", "Verbatim text with encodable entities");
EOHTML
-initialize($parser, $results);
-$parser->parse_string_document(<<'EOPOD');
+SKIP: for my $use_html_entities (0, 1) {
+ if ($use_html_entities and not $Pod::Simple::XHTML::HAS_HTML_ENTITIES) {
+ skip("HTML::Entities not installed", 1);
+ }
+ local $Pod::Simple::XHTML::HAS_HTML_ENTITIES = $use_html_entities;
+ initialize($parser, $results);
+ $parser->parse_string_document(<<'EOPOD');
=pod
# this header is very important & don't you forget it
@@ -332,6 +337,7 @@ is($results, <<"EOHTML", "Verbatim text with markup and embedded formatting");
my \$text = &quot;File is: &quot; . &lt;FILE&gt;;</code></pre>
EOHTML
+}
######################################