]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
highlight: Now adds a span with class highlight-<extension> around highlighted conten...
authorJoey Hess <joey@kitenet.net>
Tue, 12 Feb 2013 15:27:29 +0000 (11:27 -0400)
committerJoey Hess <joey@kitenet.net>
Tue, 12 Feb 2013 15:27:29 +0000 (11:27 -0400)
IkiWiki/Plugin/highlight.pm
debian/changelog

index 4e86207f101224cfb216dfbff8609ac5973bdbd5..fbe7ddff44f0c9111b63cca96f6a58fb80ac41f8 100644 (file)
@@ -89,7 +89,7 @@ sub checkconfig () {
                                id => $file,
                                call => sub {
                                        my %params=@_;
-                                       highlight($langfile, $params{content});
+                                       highlight($langfile, $file, $params{content});
                                },
                                longname => sprintf(gettext("Source code: %s"), $file),
                                @opts,
@@ -106,7 +106,7 @@ sub htmlizeformat {
                return;
        }
 
-       return Encode::decode_utf8(highlight($langfile, shift));
+       return Encode::decode_utf8(highlight($langfile, $format, shift));
 }
 
 my %ext2lang;
@@ -172,6 +172,7 @@ sub ext2langfile ($) {
 # Interface to the highlight C library.
 sub highlight ($$) {
        my $langfile=shift;
+       my $extorfile=shift;
        my $input=shift;
 
        eval q{use highlight};
@@ -200,7 +201,7 @@ sub highlight ($$) {
                $gen=$highlighters{$langfile};
        }
 
-       return $gen->generateString($input);
+       return "<div class=\"highlight-$extorfile\">".$gen->generateString($input)."</div>";
 }
 
 1
index 4e396e60f54829737dc5d4751e330c96567d4b31..b12cf19e12082f22597b51be12219b0453f79066 100644 (file)
@@ -14,6 +14,8 @@ ikiwiki (3.20121213) UNRELEASED; urgency=low
     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