user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/2] hval: replace "&apos;" with "&#39;" for compatibility
Date: Thu, 31 Oct 2019 09:19:38 +0000	[thread overview]
Message-ID: <20191031091938.24342-3-e@80x24.org> (raw)
In-Reply-To: <20191031091938.24342-1-e@80x24.org>

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 | 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/&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);
 }
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/&apos;/&#39;/sg;
-
 		IPC::Run::run($cmd, \('<pre>'.$$ref.'</pre>'), \$out, \$err);
 		# expand tabs and normalize whitespace,
 		# w3m doesn't preserve tabs

      parent reply	other threads:[~2019-10-31  9:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31  9:19 [PATCH 0/2] CSS and source highlighting fixes Eric Wong
2019-10-31  9:19 ` [PATCH 1/2] contrib/css/216light: improve contrast a bit Eric Wong
2019-10-31  9:19 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191031091938.24342-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).