diff options
author | Eric Wong <e@80x24.org> | 2019-02-05 05:28:03 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-02-05 10:58:35 +0000 |
commit | 8b8577f91109e76d12fcfa55a2e7388f54a41be6 (patch) | |
tree | 9912b7fa6a0f057916dc64a47f29a2f0491cda2c /lib/PublicInbox/WwwText.pm | |
parent | 7826c91ef37f9b5fb5396e1168d84a6574385915 (diff) | |
download | public-inbox-8b8577f91109e76d12fcfa55a2e7388f54a41be6.tar.gz |
For user documentation regarding CSS; showing users the sample CSS with comments is probably more helpful than having standalone documentation on CSS classes.
Diffstat (limited to 'lib/PublicInbox/WwwText.pm')
-rw-r--r-- | lib/PublicInbox/WwwText.pm | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm index d3413ad7..adadc37a 100644 --- a/lib/PublicInbox/WwwText.pm +++ b/lib/PublicInbox/WwwText.pm @@ -10,6 +10,10 @@ use PublicInbox::WwwStream; use PublicInbox::Hval qw(ascii_html); our $QP_URL = 'https://xapian.org/docs/queryparser.html'; our $WIKI_URL = 'https://en.wikipedia.org/wiki'; +my $hl = eval { + require PublicInbox::HlMod; + PublicInbox::HlMod->new +}; # /$INBOX/_/text/$KEY/ # KEY may contain slashes # For now, "help" is the only supported $KEY @@ -61,7 +65,13 @@ sub get_text { sub _do_linkify { my $l = PublicInbox::Linkify->new; - $_[0] = $l->linkify_2(ascii_html($l->linkify_1($_[0]))); + $l->linkify_1($_[0]); + if ($hl) { + $hl->do_hl_text(\($_[0])); + } else { + $_[0] = ascii_html($_[0]); + } + $_[0] = $l->linkify_2($_[0]); } sub _srch_prefix ($$) { @@ -91,7 +101,8 @@ sub _srch_prefix ($$) { sub _colors_help ($$) { my ($ctx, $txt) = @_; my $ibx = $ctx->{-inbox}; - my $base_url = $ibx->base_url($ctx->{env}); + my $env = $ctx->{env}; + my $base_url = $ibx->base_url($env); $$txt .= "color customization for $base_url\n"; $$txt .= <<EOF; @@ -104,23 +115,11 @@ to control the colors they see: ${base_url}userContent.css -CSS classes ------------ - - span.q - quoted text in email messages - -For diff highlighting, we try to match class names with those -used by cgit: https://git.zx2c4.com/cgit/ - - span.add - diff post-image lines - - span.del - diff pre-image lines - - span.head - diff header (metainformation) - - span.hunk - diff hunk-header - +CSS sample +---------- +```css EOF + $$txt .= PublicInbox::UserContent::sample($ibx, $env) . "```\n"; } sub _default_text ($$$) { |