* Add taglink preprocessor directive, supporting visible tag links.
[ikiwiki] / IkiWiki / Plugin / mirrorlist.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::mirrorlist;
3
4 use warnings;
5 use strict;
6 use IkiWiki 2.00;
7
8 sub import { #{{{
9         hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate);
10 } # }}}
11
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 } # }}}
19
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 } # }}}
34
35 1