X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/1cdc1e9d84b062afb203a3950fc396d8d7817108..848ff1bf5e218c57cc738a85ed02d7e1396c1d22:/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn diff --git a/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn b/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn index 2fad9f19a..dc6c0001e 100644 --- a/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn +++ b/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn @@ -1,6 +1,6 @@ Here is another [[patch]] for this. It is more up to date than either of the patches linked on the previous page. It is most similar to [[plugins/contrib/sourcehighlight]]. -Note that if this is being used with `c` or `c++` then you'll probably want to wait until [[bugs/multiple_pages_with_same_name]] is fixed. +Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. -- [[Will]] @@ -17,13 +17,13 @@ Note that if this is being used with `c` or `c++` then you'll probably want to w my %metaheaders; - sub import { #{{{ + sub import { hook(type => "getsetup", id => "sourcecode", call => \&getsetup); hook(type => "checkconfig", id => "sourcecode", call => \&checkconfig); hook(type => "pagetemplate", id => "sourcecode", call => \&pagetemplate); - } # }}} + } - sub getsetup () { #{{{ + sub getsetup () { return plugin => { safe => 1, @@ -57,9 +57,9 @@ Note that if this is being used with `c` or `c++` then you'll probably want to w safe => 1, rebuild => 1, }, - } #}}} + } - sub checkconfig () { #{{{ + sub checkconfig () { if (! $config{sourcecode_lang}) { error("The sourcecode plugin requires a list of suffixes in the 'sourcecode_lang' config option"); } @@ -92,14 +92,14 @@ Note that if this is being used with `c` or `c++` then you'll probably want to w foreach my $lang (split(/[, ]+/, $config{sourcecode_lang})) { if ($langs{$lang}) { - hook(type => "htmlize", id => $lang, call => \&htmlize); + hook(type => "htmlize", id => $lang, call => \&htmlize, keepextension => 1); } else { error("Your installation of source-highlight cannot handle sourcecode language $lang!"); } } - } #}}} + } - sub htmlize (@) { #{{{ + sub htmlize (@) { my %params=@_; my $page = $params{page}; @@ -141,9 +141,9 @@ Note that if this is being used with `c` or `c++` then you'll probably want to w } return '
'."\r\n".join("\r\n",@html)."\r\n
\n"; - } # }}} + } - sub pagetemplate (@) { #{{{ + sub pagetemplate (@) { my %params=@_; my $page=$params{page}; @@ -154,6 +154,6 @@ Note that if this is being used with `c` or `c++` then you'll probably want to w my %seen; $template->param(meta => join("\n", grep { (! $seen{$_}) && ($seen{$_}=1) } @{$metaheaders{$page}})); } - } # }}} + } 1