- if (! $config{sourcecode_lang}) {
- error("The sourcecode plugin requires a list of suffixes in the 'sourcecode_lang' config option");
- }
-
- if (! $config{sourcecode_command}) {
- $config{sourcecode_command} = "source-highlight";
- }
-
- if (! length `which $config{sourcecode_command} 2>/dev/null`) {
- error("The sourcecode plugin is unable to find the $config{sourcecode_command} command");
- }
-
- if (! $config{sourcecode_css}) {
- $config{sourcecode_css} = "sourcecode_style";
- }
-
- if (! defined $config{sourcecode_linenumbers}) {
- $config{sourcecode_linenumbers} = 1;
- }
-
- my %langs = ();
-
- open(LANGS, "$config{sourcecode_command} --lang-list|");
- while (<LANGS>) {
- if ($_ =~ /(\w+) = .+\.lang/) {
- $langs{$1} = 1;
- }
- }
- close(LANGS);
-
- foreach my $lang (split(/[, ]+/, $config{sourcecode_lang})) {
- if ($langs{$lang}) {
- hook(type => "htmlize", id => $lang, call => \&htmlize, keepextension => 1);
- } else {
- error("Your installation of source-highlight cannot handle sourcecode language $lang!");
- }
- }
+ if (! $config{sourcecode_lang}) {
+ error("The sourcecode plugin requires a list of suffixes in the 'sourcecode_lang' config option");
+ }
+
+ if (! $config{sourcecode_command}) {
+ $config{sourcecode_command} = "source-highlight";
+ }
+
+ if (! length `which $config{sourcecode_command} 2>/dev/null`) {
+ error("The sourcecode plugin is unable to find the $config{sourcecode_command} command");
+ }
+
+ if (! $config{sourcecode_css}) {
+ $config{sourcecode_css} = "sourcecode_style";
+ }
+
+ if (! defined $config{sourcecode_linenumbers}) {
+ $config{sourcecode_linenumbers} = 1;
+ }
+
+ my %langs = ();
+
+ open(LANGS, "$config{sourcecode_command} --lang-list|");
+ while (<LANGS>) {
+ if ($_ =~ /(\w+) = .+\.lang/) {
+ $langs{$1} = 1;
+ }
+ }
+ close(LANGS);
+
+ foreach my $lang (split(/[, ]+/, $config{sourcecode_lang})) {
+ if ($langs{$lang}) {
+ hook(type => "htmlize", id => $lang, no_override=>1,
+ call => sub { htmlize(lang=>$lang, @_) },
+ keepextension => 1);
+ } else {
+ error("Your installation of source-highlight cannot handle sourcecode language $lang!");
+ }
+ }