]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/highlight.pm
add news item for ikiwiki 3.20140102
[git.ikiwiki.info.git] / IkiWiki / Plugin / highlight.pm
index 33d136fbf44c0277d2a540f77b9615bc2eb6ddcc..fbe7ddff44f0c9111b63cca96f6a58fb80ac41f8 100644 (file)
@@ -52,7 +52,7 @@ sub getsetup () {
 
 sub checkconfig () {
        eval q{use highlight};
 
 sub checkconfig () {
        eval q{use highlight};
-       if (highlight::DataDir->can('new')){
+       if (highlight::DataDir->can('new')) {
                $data_dir=new highlight::DataDir();
                $data_dir->searchDataDir("");
        } else {
                $data_dir=new highlight::DataDir();
                $data_dir->searchDataDir("");
        } else {
@@ -89,7 +89,7 @@ sub checkconfig () {
                                id => $file,
                                call => sub {
                                        my %params=@_;
                                id => $file,
                                call => sub {
                                        my %params=@_;
-                                       highlight($langfile, $params{content});
+                                       highlight($langfile, $file, $params{content});
                                },
                                longname => sprintf(gettext("Source code: %s"), $file),
                                @opts,
                                },
                                longname => sprintf(gettext("Source code: %s"), $file),
                                @opts,
@@ -106,7 +106,7 @@ sub htmlizeformat {
                return;
        }
 
                return;
        }
 
-       return Encode::decode_utf8(highlight($langfile, shift));
+       return Encode::decode_utf8(highlight($langfile, $format, shift));
 }
 
 my %ext2lang;
 }
 
 my %ext2lang;
@@ -172,6 +172,7 @@ sub ext2langfile ($) {
 # Interface to the highlight C library.
 sub highlight ($$) {
        my $langfile=shift;
 # Interface to the highlight C library.
 sub highlight ($$) {
        my $langfile=shift;
+       my $extorfile=shift;
        my $input=shift;
 
        eval q{use highlight};
        my $input=shift;
 
        eval q{use highlight};
@@ -200,7 +201,7 @@ sub highlight ($$) {
                $gen=$highlighters{$langfile};
        }
 
                $gen=$highlighters{$langfile};
        }
 
-       return $gen->generateString($input);
+       return "<div class=\"highlight-$extorfile\">".$gen->generateString($input)."</div>";
 }
 
 1
 }
 
 1