2 package IkiWiki::Plugin::mirrorlist;
9 hook(type => "getsetup", id => "mirrorlist", call => \&getsetup);
10 hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate);
23 description => "list of mirrors",
27 mirrorlist_use_cgi => {
30 description => "generate links that point to the mirrors' ikiwiki CGI",
37 if (! defined $config{mirrorlist_use_cgi}) {
38 $config{mirrorlist_use_cgi}=0;
42 sub pagetemplate (@) {
44 my $template=$params{template};
46 if ($template->query(name => "extrafooter") &&
47 keys %{$config{mirrorlist}} > 0) {
48 my $value=$template->param("extrafooter");
49 $value.=mirrorlist($params{page});
50 $template->param(extrafooter => $value);
56 return ($config{html5} ? '<nav id="mirrorlist">' : '<div>').
57 (keys %{$config{mirrorlist}} > 1 ? gettext("Mirrors") : gettext("Mirror")).
62 ( $config{mirrorlist_use_cgi} ?
63 $config{mirrorlist}->{$_}."?do=goto&page=$page" :
64 $config{mirrorlist}->{$_}."/".urlto($page, "") ).
66 } keys %{$config{mirrorlist}}
68 ($config{html5} ? '</nav>' : '</div>');