diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-01-30 02:29:12 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-01-30 02:29:12 -0500 |
commit | 55e16be44a2aa1da578ef896ebac40095f606e15 (patch) | |
tree | 99919f8a43b56c30668aedca03f40dd18e30de52 /IkiWiki | |
parent | ddfa16145ac4c9938606104b685b382e2acd2f05 (diff) |
move recentchanges link enabling into a pagetemplate hook
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/recentchanges.pm | 13 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 6 |
2 files changed, 13 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 5ac0a30ef..8ceb2dfbf 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -9,6 +9,7 @@ sub import { #{{{ hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig); hook(type => "refresh", id => "recentchanges", call => \&refresh); hook(type => "htmlize", id => "_change", call => \&htmlize); + hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate); } #}}} sub checkconfig () { #{{{ @@ -32,6 +33,18 @@ sub refresh ($) { #{{{ } } #}}} +# Enable the recentchanges link on wiki pages. +sub pagetemplate (@) { #{{{ + my %params=@_; + my $template=$params{template}; + my $page=$params{page}; + if ($config{rcs} && $page ne $config{recentchangespage} && + $template->query(name => "recentchangesurl")) { + $template->param(recentchangesurl => urlto($config{recentchangespage}, $page)); + $template->param(have_actions => 1); + } +} #}}} + # Pages with extension _change have plain html markup, pass through. sub htmlize (@) { #{{{ my %params=@_; diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index be5af84ba..6dc70beb5 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -85,12 +85,6 @@ sub genpage ($$) { #{{{ $actions++; } - if ($config{rcs} && exists $config{recentchangespage} && - $page ne $config{recentchangespage}) { - $template->param(recentchangesurl => urlto($config{recentchangespage}, $page)); - $actions++; - } - if (length $config{historyurl}) { my $u=$config{historyurl}; $u=~s/\[\[file\]\]/$pagesources{$page}/g; |