id => $file,
call => sub {
my %params=@_;
- highlight($langfile, $params{content});
+ highlight($langfile, $file, $params{content});
},
longname => sprintf(gettext("Source code: %s"), $file),
@opts,
return;
}
- return Encode::decode_utf8(highlight($langfile, shift));
+ return Encode::decode_utf8(highlight($langfile, $format, shift));
}
my %ext2lang;
# Interface to the highlight C library.
sub highlight ($$) {
my $langfile=shift;
+ my $extorfile=shift;
my $input=shift;
eval q{use highlight};
$gen=$highlighters{$langfile};
}
- return $gen->generateString($input);
+ return "<div class=\"highlight-$extorfile\">".$gen->generateString($input)."</div>";
}
1
dynamic cgi pages, which cannot use trail anyway.
* Deal with empty diffurl in configuration.
* cvs: Various fixes.
+ * highlight: Now adds a span with class highlight-<extension> around
+ highlighted content, allowing for language-specific css styling.
-- Joey Hess <joeyh@debian.org> Sat, 22 Dec 2012 16:15:24 -0400