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]]
14 > I couldn't figure out what to make it from, but thinking it through,
15 > yeah, it should be $page. Revised patch follows. --Ethan
18 diff -urNX ignorepats ikiwiki/IkiWiki/Plugin/rst.pm ikidev/IkiWiki/Plugin/rst.pm
19 --- ikiwiki/IkiWiki/Plugin/rst.pm 2006-09-25 14:30:40.000000000 -0700
20 +++ ikidev/IkiWiki/Plugin/rst.pm 2007-02-27 22:44:11.040042000 -0800
22 html = publish_string(stdin.read(), writer_name='html',
23 settings_overrides = { 'halt_level': 6,
24 'file_insertion_enabled': 0,
28 print html[html.find('<body>')+6:html.find('</body>')].strip();
32 - hook(type => "htmlize", id => "rst", call => \&htmlize);
33 + hook(type => "htmlize", id => "rst", call => \&htmlize, escape => \&escape);
36 +sub escape ($) { #{{{
39 + return ".. raw:: html\n\n".$html;
42 sub htmlize (@) { #{{{
43 diff -urNX ignorepats ikiwiki/IkiWiki/Plugin/shortcut.pm ikidev/IkiWiki/Plugin/shortcut.pm
44 --- ikiwiki/IkiWiki/Plugin/shortcut.pm 2007-02-15 00:38:48.000000000 -0800
45 +++ ikidev/IkiWiki/Plugin/shortcut.pm 2007-02-27 22:09:31.536088000 -0800
47 sub checkconfig () { #{{{
48 # Preprocess the shortcuts page to get all the available shortcuts
49 # defined before other pages are rendered.
50 + $pagesources{"shortcuts"} = "shortcuts.mdwn";
51 IkiWiki::preprocess("shortcuts", "shortcuts",
52 readfile(srcfile("shortcuts.mdwn")));
54 diff -urNX ignorepats ikiwiki/IkiWiki.pm ikidev/IkiWiki.pm
55 --- ikiwiki/IkiWiki.pm 2007-02-25 15:01:27.211170000 -0800
56 +++ ikidev/IkiWiki.pm 2007-03-01 18:20:39.910925000 -0800
58 destpage => $destpage,
60 $preprocessing{$page}--;
61 + if ($ret =~ /[<>]/){
62 + if ($pagesources{$page}) {
63 + my $type=pagetype($pagesources{$page});
64 + if ($hooks{htmlize}{$type}{escape}) {
65 + $ret = $hooks{htmlize}{$type}{escape}->(