]> Sergey Matveev's repositories - public-inbox.git/commitdiff
hval: replace "'" with "'" for compatibility
authorEric Wong <e@80x24.org>
Thu, 31 Oct 2019 09:19:38 +0000 (09:19 +0000)
committerEric Wong <e@80x24.org>
Thu, 31 Oct 2019 09:20:04 +0000 (09:20 +0000)
While testing 216light.css changes, I managed to hit some cases
where dillo failed to render &apos; correctly, but I also can't
reproduce it reliably.  Anyways, it's definitely a problem with
some old browsers and newer versions of highlight already work
around it, but Debian 10.x has 3.41, so use "&#39;" to maximize
compatibility.

lib/PublicInbox/Hval.pm
t/hl_mod.t

index c134e297280eeff734f0a2170eeac48386c395ec..4a79439f8e27f23f320ed05e288b5d8848150fef 100644 (file)
@@ -58,8 +58,11 @@ my %xhtml_map = (
 $xhtml_map{chr($_)} = sprintf('\\x%02x', $_) for (0..31);
 %xhtml_map = (%xhtml_map, %escape_sequence);
 
+# for post-processing the output of highlight.pm and perhaps other
+# highlighers in the future
 sub src_escape ($) {
        $_[0] =~ s/\r\n/\n/sg;
+       $_[0] =~ s/&apos;/&#39;/sg; # workaround https://bugs.debian.org/927409
        $_[0] =~ s/([\x7f\x00-\x1f])/$xhtml_map{$1}/sge;
        $_[0] = $enc_ascii->encode($_[0], Encode::HTMLCREF);
 }
index fc7b712cea6945a4031274e63d0c05c6ed669e16..52ef39dcbd2651ab592219cdff31e4542dd16e59 100644 (file)
@@ -31,9 +31,6 @@ my $orig = $str;
                my $cmd = [ qw(w3m -T text/html -dump -config /dev/null) ];
                my ($out, $err) = ('', '');
 
-               # workaround https://bugs.debian.org/927409
-               $$ref =~ s/&apos;/&#39;/sg;
-
                IPC::Run::run($cmd, \('<pre>'.$$ref.'</pre>'), \$out, \$err);
                # expand tabs and normalize whitespace,
                # w3m doesn't preserve tabs