]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/mirrorlist.pm
Move about: fix to version 2.31.3 in the changelog
[git.ikiwiki.info.git] / IkiWiki / Plugin / mirrorlist.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::mirrorlist;
4 use warnings;
5 use strict;
6 use IkiWiki 2.00;
8 sub import { #{{{
9         hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate);
10 } # }}}
12 sub pagetemplate (@) { #{{{
13         my %params=@_;
14         my $template=$params{template};
15         
16         $template->param(extrafooter => mirrorlist($params{page}))
17                 if $template->query(name => "extrafooter");
18 } # }}}
20 sub mirrorlist ($) { #{{{
21         my $page=shift;
22         return "<p>".
23                 (keys %{$config{mirrorlist}} > 1 ? gettext("Mirrors") : gettext("Mirror")).
24                 ": ".
25                 join(", ",
26                         map { 
27                                 qq{<a href="}.
28                                 $config{mirrorlist}->{$_}."/".urlto($page, "").
29                                 qq{">$_</a>}
30                         } keys %{$config{mirrorlist}}
31                 ).
32                 "</p>";
33 } # }}}
35 1