diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-26 21:54:44 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-26 21:54:44 +0000 |
commit | d9c118dbf1753abcbf081f532aecfe8cb6ce7de7 (patch) | |
tree | 4760a558c0ab1f7cbd4d44454c3f36cd072fe78c /IkiWiki/Render.pm | |
parent | 061afedb261f67731acac341811f4b086da2ab92 (diff) |
* Run page through any relevant filters when generating a page preview.
* Noticed a bug in the wikitext markup plugin -- it made CamelCase links the
default throughout the wiki, not only on wikitext pages. Decided to call
this a feature, and split the camelcase support out into a separate plugin
that is independant of wikitext.
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r-- | IkiWiki/Render.pm | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 6d5ea9ee5..e5a1679f8 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -250,6 +250,22 @@ sub findlinks ($$) { #{{{ } } #}}} +sub filter ($$) { + my $page=shift; + my $content=shift; + + if (exists $hooks{filter}) { + foreach my $id (keys %{$hooks{filter}}) { + $content=$hooks{filter}{$id}{call}->( + page => $page, + content => $content + ); + } + } + + return $content; +} + sub render ($) { #{{{ my $file=shift; @@ -260,14 +276,7 @@ sub render ($) { #{{{ my $page=pagename($file); delete $depends{$page}; - if (exists $hooks{filter}) { - foreach my $id (keys %{$hooks{filter}}) { - $content=$hooks{filter}{$id}{call}->( - page => $page, - content => $content - ); - } - } + $content=filter($page, $content); $links{$page}=[findlinks($page, $content)]; |