}
sub checkconfig () {
-
eval q{use highlight};
- if ($@) {
- print STDERR "Failed to load highlight. Configuring anyway.\n";
- };
-
- if (highlight::DataDir->can('new')){
+ if (highlight::DataDir->can('new')) {
$data_dir=new highlight::DataDir();
$data_dir->searchDataDir("");
} else {
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