1 Since some preprocessor directives insert raw HTML, it would be good to
2 specify, per-format, how to pass HTML so that it goes through the format
3 OK. With Markdown we cross our fingers; with reST we use the "raw"
6 I added an extra named parameter to the htmlize hook, which feels sort of
7 wrong, since none of the other hooks take parameters. Let me know what
10 Seems fairly reasonable, actually. Shouldn't the `$type` come from `$page`
11 instead of `$destpage` though? Only other obvious change is to make the
12 escape parameter optional, and only call it if set. --[[Joey]]
15 diff -urX ignorepats clean-ikidev/IkiWiki/Plugin/mdwn.pm ikidev/IkiWiki/Plugin/mdwn.pm
16 --- clean-ikidev/IkiWiki/Plugin/mdwn.pm 2007-02-25 12:26:54.031200000 -0800
17 +++ ikidev/IkiWiki/Plugin/mdwn.pm 2007-02-27 21:26:43.556095000 -0800
22 - hook(type => "htmlize", id => "mdwn", call => \&htmlize);
23 + hook(type => "htmlize", id => "mdwn", call => \&htmlize, escape => \&escape);
26 +sub escape ($) { #{{{
32 diff -urX ignorepats clean-ikidev/IkiWiki/Plugin/rst.pm ikidev/IkiWiki/Plugin/rst.pm
33 --- clean-ikidev/IkiWiki/Plugin/rst.pm 2007-02-25 12:26:54.501830000 -0800
34 +++ ikidev/IkiWiki/Plugin/rst.pm 2007-02-27 22:44:11.040042000 -0800
36 html = publish_string(stdin.read(), writer_name='html',
37 settings_overrides = { 'halt_level': 6,
38 'file_insertion_enabled': 0,
42 print html[html.find('<body>')+6:html.find('</body>')].strip();
46 - hook(type => "htmlize", id => "rst", call => \&htmlize);
47 + hook(type => "htmlize", id => "rst", call => \&htmlize, escape => \&escape);
50 +sub escape ($) { #{{{
53 + return ".. raw:: html\n\n".$html;
56 sub htmlize (@) { #{{{
57 diff -urX ignorepats clean-ikidev/IkiWiki/Plugin/shortcut.pm ikidev/IkiWiki/Plugin/shortcut.pm
58 --- clean-ikidev/IkiWiki/Plugin/shortcut.pm 2007-02-25 12:26:54.538830000 -0800
59 +++ ikidev/IkiWiki/Plugin/shortcut.pm 2007-02-27 22:09:31.536088000 -0800
61 sub checkconfig () { #{{{
62 # Preprocess the shortcuts page to get all the available shortcuts
63 # defined before other pages are rendered.
64 + $pagesources{"shortcuts"} = "shortcuts.mdwn";
65 IkiWiki::preprocess("shortcuts", "shortcuts",
66 readfile(srcfile("shortcuts.mdwn")));
68 diff -urX ignorepats clean-ikidev/IkiWiki.pm ikidev/IkiWiki.pm
69 --- clean-ikidev/IkiWiki.pm 2007-02-25 12:26:58.812850000 -0800
70 +++ ikidev/IkiWiki.pm 2007-02-27 22:09:28.149568000 -0800
72 destpage => $destpage,
74 $preprocessing{$page}--;
75 + if ($ret =~ /[<>]/){
76 + my $type=pagetype($pagesources{$destpage});
77 + $ret = $hooks{htmlize}{$type}{escape}->(