X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/cf6843f1baa54e953e1aadf06118806d71c131ca..442f3ab0aba88b61abecf23c6f9539ea494e9537:/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn?ds=inline 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 467ec350e..8953a055e 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 @@ -4,6 +4,37 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. -- [[Will]] +---- +I was trying to replace sourcehighlight with sourcecode. I had to modify the +htmlize call slightly so that it would work in a format directive. +([modified version](http://pivot.cs.unb.ca/git/?p=ikiplugins.git;a=blob_plain;f=IkiWiki/Plugin/sourcecode.pm;hb=21fc57091edb9)) + +> I haven't tested them, but those changes look sensible to me. -- [[Will]] + +I hit a wall the following example (the last commit in the above repo). + + \[[!meta title="Solutions to assignment 1"]] + + - [[!format cc """ + test + """]] + + +> I haven't actually tested this to see what the problem is. How does this fail? +> Does source-highlight barf on the non-c++ content? Is there a wiki URL that shows the failure? -- [[Will]] +>> Here is the content div from the output page +>> [[DavidBremner]] + +
+

+ 2beb4fd7289998159f61976143f66bb6

+ +

+ + + ---- #!/usr/bin/perl @@ -17,13 +48,13 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. 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 +88,9 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. 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"); } @@ -97,9 +128,9 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. error("Your installation of source-highlight cannot handle sourcecode language $lang!"); } } - } #}}} + } - sub htmlize (@) { #{{{ + sub htmlize (@) { my %params=@_; my $page = $params{page}; @@ -141,9 +172,9 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. } return '
'."\r\n".join("\r\n",@html)."\r\n
\n"; - } # }}} + } - sub pagetemplate (@) { #{{{ + sub pagetemplate (@) { my %params=@_; my $page=$params{page}; @@ -154,6 +185,6 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. my %seen; $template->param(meta => join("\n", grep { (! $seen{$_}) && ($seen{$_}=1) } @{$metaheaders{$page}})); } - } # }}} + } 1