]> Sergey Matveev's repositories - public-inbox.git/commitdiff
hlmod: disable enclosing <pre> tag
authorEric Wong <e@80x24.org>
Sun, 27 Jan 2019 11:36:22 +0000 (11:36 +0000)
committerEric Wong <e@80x24.org>
Sun, 27 Jan 2019 11:43:34 +0000 (11:43 +0000)
We already have a <pre> tag in ViewVCS, and nesting <pre>
inside the pre-existing <pre> overrides the "white-space:pre"
we use to align line numbers.

lib/PublicInbox/HlMod.pm
t/hl_mod.t

index 5cbfb29862ecffa6a1119ef46b7d599b5b7bb830..237ffaca0a23723381a28e1cc2d1f7c4aa59e464 100644 (file)
@@ -99,7 +99,6 @@ sub do_hl {
        my $gen = $self->{$langpath} ||= do {
                my $g = highlight::CodeGenerator::getInstance($highlight::HTML);
                $g->setFragmentCode(1); # generate html fragment
-               $g->setHTMLEnclosePreTag(1); # include <pre>
 
                # whatever theme works
                my $themepath = $dir->getThemePath('print.theme');
index 62cc62488f51479c401fda9c76103857f57fd5c0..80f88907e4ed577f74ed3e95d5a281cdd84c6d2f 100644 (file)
@@ -27,7 +27,7 @@ my $orig = $str;
                require File::Temp;
                my $cmd = [ qw(w3m -T text/html -dump -config /dev/null) ];
                my ($out, $err) = ('', '');
-               IPC::Run::run($cmd, $ref, \$out, \$err);
+               IPC::Run::run($cmd, \('<pre>'.$$ref.'</pre>'), \$out, \$err);
                # expand tabs and normalize whitespace,
                # w3m doesn't preserve tabs
                $orig =~ s/\t/        /gs;