-diff -urX ignorepats clean-ikidev/IkiWiki/Plugin/shortcut.pm ikidev/IkiWiki/Plugin/shortcut.pm
---- clean-ikidev/IkiWiki/Plugin/shortcut.pm 2007-02-25 12:26:54.538830000 -0800
-+++ ikidev/IkiWiki/Plugin/shortcut.pm 2007-02-27 22:09:31.536088000 -0800
-@@ -13,6 +13,7 @@
- sub checkconfig () { #{{{
- # Preprocess the shortcuts page to get all the available shortcuts
- # defined before other pages are rendered.
-+ $pagesources{"shortcuts"} = "shortcuts.mdwn";
- IkiWiki::preprocess("shortcuts", "shortcuts",
- readfile(srcfile("shortcuts.mdwn")));
- } # }}}
-diff -urX ignorepats clean-ikidev/IkiWiki.pm ikidev/IkiWiki.pm
---- clean-ikidev/IkiWiki.pm 2007-02-25 12:26:58.812850000 -0800
-+++ ikidev/IkiWiki.pm 2007-02-27 22:09:28.149568000 -0800
-@@ -568,6 +577,13 @@
- destpage => $destpage,
- );
- $preprocessing{$page}--;
-+ if ($ret =~ /[<>]/){
-+ my $type=pagetype($pagesources{$destpage});
-+ $ret = $hooks{htmlize}{$type}{escape}->(
-+ $ret,
-+ );
-+ }
+ my %params=@_;
+ my $content=$params{content};
+Index: doc/plugins/write.mdwn
+===================================================================
+--- doc/plugins/write.mdwn (revision 3197)
++++ doc/plugins/write.mdwn (working copy)
+@@ -121,6 +121,26 @@
+ The function is passed named parameters: "page" and "content" and should
+ return the htmlized content.
+
++### htmlescape
++
++ hook(type => "htmlescape", id => "ext", call => \&htmlescape);
++
++Some markup languages do not allow raw html to be mixed in with the markup
++language, and need it to be escaped in some way. This hook is a companion
++to the htmlize hook, and is called when ikiwiki detects that a preprocessor
++directive is inserting raw html. It is passed the chunk of html in
++question, and should return the escaped chunk.
++
++### htmlescapelink
++
++ hook(type => "htmlescapelink", id => "ext", call => \&htmlescapelink);
++
++Some markup languages have special syntax to link to other pages. This hook
++is a companion to the htmlize and htmlescape hooks, and it is called when a
++link is inserted. It is passed the target of the link and the text of the
++link, and an optional named parameter "broken" if a broken link is being
++generated. It should return the correctly-formatted link.
++
+ ### pagetemplate
+
+ hook(type => "pagetemplate", id => "foo", call => \&pagetemplate);
+@@ -355,6 +375,7 @@
+ * forcesubpage - set to force a link to a subpage
+ * linktext - set to force the link text to something
+ * anchor - set to make the link include an anchor
++* genhtml - set to generate HTML and not escape for correct format
+
+ #### `readfile($;$)`
+
+Index: doc/plugins/rst.mdwn
+===================================================================
+--- doc/plugins/rst.mdwn (revision 3197)
++++ doc/plugins/rst.mdwn (working copy)
+@@ -10,10 +10,8 @@
+ Note that this plugin does not interoperate very well with the rest of
+ ikiwiki. Limitations include:
+
+-* reStructuredText does not allow raw html to be inserted into
+- documents, but ikiwiki does so in many cases, including
+- [[WikiLinks|WikiLink]] and many
+- [[PreprocessorDirectives|PreprocessorDirective]].
++* Some bits of ikiwiki may still assume that markdown is used or embed html
++ in ways that break reStructuredText. (Report bugs if you find any.)
+ * It's slow; it forks a copy of python for each page. While there is a
+ perl version of the reStructuredText processor, it is not being kept in
+ sync with the standard version, so is not used.
+Index: IkiWiki.pm
+===================================================================
+--- IkiWiki.pm (revision 3197)
++++ IkiWiki.pm (working copy)
+@@ -469,6 +469,10 @@
+ my $page=shift; # the page that will contain the link (different for inline)
+ my $link=shift;
+ my %opts=@_;
++ # we are processing $lpage and so we need to format things in accordance
++ # with the formatting language of $lpage. inline generates HTML so links
++ # will be escaped seperately.
++ my $type=pagetype($pagesources{$lpage});
+
+ my $bestlink;
+ if (! $opts{forcesubpage}) {
+@@ -494,12 +498,17 @@
+ }
+ if (! grep { $_ eq $bestlink } map { @{$_} } values %renderedfiles) {
+ return $linktext unless length $config{cgiurl};
+- return "<span><a href=\"".
+- cgiurl(
+- do => "create",
+- page => pagetitle(lc($link), 1),
+- from => $lpage
+- ).
++ my $url = cgiurl(
++ do => "create",
++ page => pagetitle(lc($link), 1),
++ from => $lpage
++ );
++
++ if ($hooks{htmlescapelink}{$type} && ! $opts{genhtml}){
++ return $hooks{htmlescapelink}{$type}{call}->($url, $linktext,
++ broken => 1);
++ }
++ return "<span><a href=\"". $url.
+ "\">?</a>$linktext</span>"
+ }
+
+@@ -514,6 +523,9 @@
+ $bestlink.="#".$opts{anchor};
+ }
+
++ if ($hooks{htmlescapelink}{$type} && !$opts{genhtml}) {
++ return $hooks{htmlescapelink}{$type}{call}->($bestlink, $linktext);
++ }
+ return "<a href=\"$bestlink\">$linktext</a>";
+ } #}}}
+
+@@ -628,6 +640,14 @@
+ preview => $preprocess_preview,
+ );
+ $preprocessing{$page}--;