Skip Menu |

This queue is for tickets about the Pod-HtmlEasy CPAN distribution.

Report information
The Basics
Id: 131199
Status: new
Priority: 0/
Queue: Pod-HtmlEasy

People
Owner: Nobody in particular
Requestors: tn5v2l [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: HtmlEasy forcibly replace URIs
As described in the topic "EMBEDDED URIs" (https://metacpan.org/pod/release/GLEACH/Pod-HtmlEasy-v1.1.11a/lib/Pod/HtmlEasy.pm#EMBEDDED-URIs), HtmlEasy should not replace URIs, embedded in L<> ot indented as raw source code. But thay do that. For example: L<http://example.com/cgi-bin/gifarrow.pl?w=50&h=50&f=100> parced to the next html code: <p><a href='http://example.com/cgi-bin/gifarrow.pl?w=50' target='_blank'>example.com</a>&amp;h=50&amp;f=100</p>
I'm worked around this problem and make following solution: Show quoted text
________________ Author: An0ther0ne <An0ther0ne> 2019-12-20 03:21:23 Committer: An0ther0ne <An0ther0ne> 2019-12-20 03:21:23 Tags: v1.1.11c Parent: 69e1e41ad37ac6fbd3222c8e358a9d385fd77c6d (change charset and css) Branches: master, remotes/origin/master Precedes: fix 131199 bug -------------------------- lib/Pod/HtmlEasy/Parser.pm -------------------------- index 3639c1e..6c2a001 100644 @@ -118,8 +118,8 @@ $HTML_ENTITIES_RE = qr{$HTML_ENTITIES_RE}msx; # from the same characters that get converted to entity names sub _nul_escape { my $txt_ref = shift; - - ${$txt_ref} =~ s{($HTML_ENTITIES_RE)}{$NUL$1}gsmx; +# ${$txt_ref} =~ s{($HTML_ENTITIES_RE)}{$NUL$1}gsmx; + ${$txt_ref} =~ s{($HTML_ENTITIES_RE)}{$1}gsmx; return; } @@ -147,7 +147,8 @@ sub _encode_entities { # $chr gets a lookbehind to avoid converting flagged from E<...> my $re = qq{(?<!$NUL)$chr}; - ${$txt_ref} =~ s{$re}{$NUL&$HTML_ENTITIES{$chr};}gsmx; +# ${$txt_ref} =~ s{$re}{$NUL&$HTML_ENTITIES{$chr};}gsmx; + ${$txt_ref} =~ s{$re}{&$HTML_ENTITIES{$chr};}gsmx; } return; @@ -166,6 +167,7 @@ sub _encode_entities { sub _add_uri_href { my ($txt_ref) = @_; + if ( ${$txt_ref} =~ m{https?:}smx ) { # Replace escaped characters in URL with their ASCII equivalents @@ -189,6 +191,7 @@ sub _add_uri_href { # my $host = $3; # $uri =~ s{[^/\w]+\z}{}mx; # ${$txt_ref} =~ s{$uri}{<a href='$uri' target='_blank'>$host</a>}mx; + return if ${$txt_ref} =~ /^<pre>/; ${$txt_ref} =~ s{$RE{URI}{HTTP}{-keep}{-scheme=>'https?'}}{<a href='$1' target='_blank'>$3</a>}gsmx; @@ -460,10 +463,10 @@ sub interior_sequence { return EMPTY; } my @parsed = Pod::ParseLink::parselink($seq_argument); - foreach (@parsed) { - if ( defined $_ ) { _encode_entities( \$_ ); } - } - +# This is double encode +# foreach (@parsed) { +# if ( defined $_ ) { _encode_entities( \$_ ); } +# } # Encoding handled in ON_L() $ret = $parser->{POD_HTMLEASY} ->{ON_L}( $parser->{POD_HTMLEASY}, @parsed ); @@ -493,7 +496,6 @@ sub interior_sequence { # Escape HTML-significant characters _nul_escape( \$ret ); - return $ret; }