diff options
Diffstat (limited to 'lib/PublicInbox/WwwHighlight.pm')
-rw-r--r-- | lib/PublicInbox/WwwHighlight.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/PublicInbox/WwwHighlight.pm b/lib/PublicInbox/WwwHighlight.pm index 01916401..bc349f8a 100644 --- a/lib/PublicInbox/WwwHighlight.pm +++ b/lib/PublicInbox/WwwHighlight.pm @@ -24,6 +24,8 @@ use warnings; use bytes (); # only for bytes::length use HTTP::Status qw(status_message); use parent qw(PublicInbox::HlMod); +use PublicInbox::Linkify qw(); +use PublicInbox::Hval qw(ascii_html); # TODO: support highlight(1) for distros which don't package the # SWIG extension. Also, there may be admins who don't want to @@ -64,7 +66,14 @@ sub call { return r(405) if $req_method ne 'PUT'; my $bref = read_in_full($env) or return r(500); - $bref = $self->do_hl($bref, $env->{PATH_INFO}); + my $l = PublicInbox::Linkify->new; + $l->linkify_1($$bref); + if (my $res = $self->do_hl($bref, $env->{PATH_INFO})) { + $bref = $res; + } else { + $$bref = ascii_html($$bref); + } + $l->linkify_2($$bref); my $h = [ 'Content-Type', 'text/html; charset=UTF-8' ]; push @$h, 'Content-Length', bytes::length($$bref); |