aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/highlight.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-02-12 11:27:29 -0400
committerJoey Hess <joey@kitenet.net>2013-02-12 11:27:29 -0400
commit480d6f93c13ac3f0fbe931c9abfbcb105f235fd0 (patch)
tree792f1cbd730ea83041dd1faf2c8400e3dbd9cb3b /IkiWiki/Plugin/highlight.pm
parent22146aa4a34074bed465de7fb5999ea121808524 (diff)
downloadikiwiki-480d6f93c13ac3f0fbe931c9abfbcb105f235fd0.tar
ikiwiki-480d6f93c13ac3f0fbe931c9abfbcb105f235fd0.tar.gz
highlight: Now adds a span with class highlight-<extension> around highlighted content, allowing for language-specific css styling.
Diffstat (limited to 'IkiWiki/Plugin/highlight.pm')
-rw-r--r--IkiWiki/Plugin/highlight.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm
index 4e86207f1..fbe7ddff4 100644
--- a/IkiWiki/Plugin/highlight.pm
+++ b/IkiWiki/Plugin/highlight.pm
@@ -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