use IkiWiki 2.00;
sub import { #{{{
+ hook(type => "getsetup", id => "recentchanges", call => \&getsetup);
hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig);
hook(type => "refresh", id => "recentchanges", call => \&refresh);
hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate);
hook(type => "cgi", id => "recentchanges", call => \&cgi);
} #}}}
+sub getsetup () { #{{{
+ return
+ plugin => {
+ safe => 1,
+ rebuild => 1,
+ },
+ recentchangespage => {
+ type => "string",
+ example => "recentchanges",
+ description => "name of the recentchanges page",
+ safe => 1,
+ rebuild => 1,
+ },
+ recentchangesnum => {
+ type => "integer",
+ example => 100,
+ description => "number of changes to track",
+ safe => 1,
+ rebuild => 0,
+ },
+} #}}}
+
sub checkconfig () { #{{{
$config{recentchangespage}='recentchanges' unless defined $config{recentchangespage};
$config{recentchangesnum}=100 unless defined $config{recentchangesnum};
my $template=$params{template};
my $page=$params{page};
- # XXX this is here because I've been seeing a strange uninitialized
- # value in this sub.
- if (! defined $config{recentchangespage}) {
- eval q{use Carp};
- Carp::cluck("undefined recentchangespage; please report this to Joey");
- }
-
- if ($config{rcs} && $page ne $config{recentchangespage} &&
+ if (defined $config{recentchangespage} && $config{rcs} &&
+ $page ne $config{recentchangespage} &&
$template->query(name => "recentchangesurl")) {
$template->param(recentchangesurl => urlto($config{recentchangespage}, $page));
$template->param(have_actions => 1);
"</p>");
}
else {
- IkiWiki::redirect($cgi, $config{url}."/".htmlpage($link));
+ IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".htmlpage($link)));
}
exit;