]> Sergey Matveev's repositories - public-inbox.git/commitdiff
hlmod: do_hl* performs src_escape immediately
authorEric Wong <e@80x24.org>
Sat, 2 Feb 2019 16:46:47 +0000 (16:46 +0000)
committerEric Wong <e@80x24.org>
Tue, 5 Feb 2019 10:58:35 +0000 (10:58 +0000)
We want to be able to take advantage of this in other modules

lib/PublicInbox/HlMod.pm
lib/PublicInbox/ViewVCS.pm

index 13f27d19cb40b85e8d5bbc33a22525c31576a551..014d82fdbc52cb9293a96e0a8829154bb0e85ad3 100644 (file)
@@ -16,6 +16,7 @@ package PublicInbox::HlMod;
 use strict;
 use warnings;
 use highlight; # SWIG-generated stuff
+use PublicInbox::Hval qw(src_escape);
 my $hl;
 
 sub _parse_filetypes ($) {
@@ -122,6 +123,7 @@ sub do_hl_lang {
        # know that, so ensure it's marked as UTF-8 even if it isnt...
        my $out = $gen->generateString($$str);
        utf8::decode($out);
+       src_escape($out);
        \$out;
 }
 
index 0fb6b64e49e8b8d2e9068981c864537a63334830..f6a769427dfae230a1bd9a3261063768852af999 100644 (file)
@@ -19,7 +19,7 @@ use warnings;
 use PublicInbox::SolverGit;
 use PublicInbox::WwwStream;
 use PublicInbox::Linkify;
-use PublicInbox::Hval qw(ascii_html to_filename src_escape);
+use PublicInbox::Hval qw(ascii_html to_filename);
 my $hl = eval {
        require PublicInbox::HlMod;
        PublicInbox::HlMod->new;
@@ -123,7 +123,6 @@ sub solve_result {
        $l->linkify_1($$blob);
        my $ok = $hl->do_hl($blob, $path) if $hl;
        if ($ok) {
-               src_escape($$ok);
                $blob = $ok;
        } else {
                $$blob = ascii_html($$blob);