user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/2] CSS and source highlighting fixes
@ 2019-10-31  9:19 Eric Wong
  2019-10-31  9:19 ` [PATCH 1/2] contrib/css/216light: improve contrast a bit Eric Wong
  2019-10-31  9:19 ` [PATCH 2/2] hval: replace "'" with "'" for compatibility Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2019-10-31  9:19 UTC (permalink / raw)
  To: meta

We'll only be supporting highlight.pm this release, so at
least try to do it right for people not using dark color
schemes.  My eyes are tired now after attempting to use
dillo and light colors :<

Eric Wong (2):
  contrib/css/216light: improve contrast a bit
  hval: replace "&apos;" with "&#39;" for compatibility

 contrib/css/216light.css | 24 ++++++++++++++++++++++++
 lib/PublicInbox/Hval.pm  |  3 +++
 t/hl_mod.t               |  3 ---
 3 files changed, 27 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] contrib/css/216light: improve contrast a bit
  2019-10-31  9:19 [PATCH 0/2] CSS and source highlighting fixes Eric Wong
@ 2019-10-31  9:19 ` Eric Wong
  2019-10-31  9:19 ` [PATCH 2/2] hval: replace "&apos;" with "&#39;" for compatibility Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2019-10-31  9:19 UTC (permalink / raw)
  To: meta

"#ff0" foreground on a "#fff" background is just too difficult
to distinguish, among other things.  So choose slightly darker
colors when using a (painful) "#fff" background.

---
 contrib/css/216light.css | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/contrib/css/216light.css b/contrib/css/216light.css
index 9451dc0..559a6b7 100644
--- a/contrib/css/216light.css
+++ b/contrib/css/216light.css
@@ -24,3 +24,27 @@ a:visited { color:#808 }
 *.del {color:#900 }
 *.head { color:#000 }
 *.hunk { color:#960 }
+
+/*
+ * highlight 3.x colors (tested 3.18) for displaying blobs.
+ * This doesn't use most of the colors available, as I find too
+ * many colors overwhelming, so the default is commented out.
+ */
+.hl.num { color:#f30 } /* number */
+.hl.esc { color:#f0f } /* escape character */
+.hl.str { color:#f30 } /* string */
+.hl.ppc { color:#c3c } /* preprocessor */
+.hl.pps { color:#f30 } /* preprocessor string */
+.hl.slc { color:#099 } /* single-line comment */
+.hl.com { color:#099 } /* multi-line comment */
+/* .hl.opt { color:#ccc } */ /* operator */
+/* .hl.ipl { color:#ccc } */ /* interpolation */
+
+/* keyword groups kw[a-z] */
+.hl.kwa { color:#f90 }
+.hl.kwb { color:#060 }
+.hl.kwc { color:#f90 }
+/* .hl.kwd { color:#ccc } */
+
+/* line-number (unused by public-inbox) */
+/* .hl.lin { color:#ccc } */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] hval: replace "&apos;" with "&#39;" for compatibility
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2019-10-31  9:19 UTC (permalink / raw)
  To: meta

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-31  9:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] hval: replace "&apos;" with "&#39;" for compatibility Eric Wong

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).