From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id EF5181F4C3 for ; Thu, 31 Oct 2019 09:19:38 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/2] hval: replace "'" with "'" for compatibility Date: Thu, 31 Oct 2019 09:19:38 +0000 Message-Id: <20191031091938.24342-3-e@80x24.org> In-Reply-To: <20191031091938.24342-1-e@80x24.org> References: <20191031091938.24342-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: While testing 216light.css changes, I managed to hit some cases where dillo failed to render ' 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 "'" to maximize compatibility. --- lib/PublicInbox/Hval.pm | 3 +++ t/hl_mod.t | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm index c134e29..4a79439 100644 --- a/lib/PublicInbox/Hval.pm +++ b/lib/PublicInbox/Hval.pm @@ -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/'/'/sg; # workaround https://bugs.debian.org/927409 $_[0] =~ s/([\x7f\x00-\x1f])/$xhtml_map{$1}/sge; $_[0] = $enc_ascii->encode($_[0], Encode::HTMLCREF); } diff --git a/t/hl_mod.t b/t/hl_mod.t index fc7b712..52ef39d 100644 --- a/t/hl_mod.t +++ b/t/hl_mod.t @@ -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/'/'/sg; - IPC::Run::run($cmd, \('
'.$$ref.'
'), \$out, \$err); # expand tabs and normalize whitespace, # w3m doesn't preserve tabs