From 6f9b52285d14e4246387d3bdcd65681b8af4961a Mon Sep 17 00:00:00 2001 From: Tomasz Konojacki Date: Tue, 17 Jun 2025 21:39:21 +0200 Subject: [PATCH] Pod::Simple::XHTML: better fallback when HTML::Entities isn't installed This commit changes the default set of escaped characters in the fallback code to be the same as in HTML::Entities. Fixes #188 --- lib/Pod/Simple/XHTML.pm | 5 +++-- t/xhtml01.t | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/Pod/Simple/XHTML.pm b/lib/Pod/Simple/XHTML.pm index 07cee5da..c20fb437 100644 --- a/lib/Pod/Simple/XHTML.pm +++ b/lib/Pod/Simple/XHTML.pm @@ -70,10 +70,11 @@ sub encode_entities { $ents =~ s,(? 66; +use Test::More tests => 68; use_ok('Pod::Simple::XHTML') or exit; @@ -712,7 +712,7 @@ is($results, "$html\n\n", "Text with =begin html"); 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", 3); + skip("HTML::Entities not installed", 4); } local $Pod::Simple::XHTML::HAS_HTML_ENTITIES = $use_html_entities; initialize($parser, $results); @@ -751,11 +751,28 @@ EOHTML # Keep =encoding out of content. initialize($parser, $results); $parser->parse_string_document("=encoding ascii\n\n=head1 NAME\n"); - is($results, <<"EOHTML", 'Encoding should not be in content') + is($results, <<"EOHTML", 'Encoding should not be in content');

NAME

EOHTML + initialize($parser, $results); + $parser->parse_string_document(<<"EOPOD"); +=pod + +=encoding UTF-8 + +The pilcrow, ΒΆ, is used to mark the beginning of a new paragraph. + +=cut + +EOPOD + + $T = $use_html_entities ? '¶' : '¶'; + is($results, <<"EOHTML", 'Non-ASCII characters are escaped') +

The pilcrow, ${T}, is used to mark the beginning of a new paragraph.

+ +EOHTML }