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 \
    --subject='Re: [PATCH 2/2] hval: replace "&apos;" with "&#39;" for compatibility' \
    /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

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.mail.public-inbox.meta
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.mail.public-inbox.meta
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git