summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-23 01:07:11 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-23 01:07:11 +0000
commitd83d11e6b87e718872e72153ee6bb3a382615c25 (patch)
tree8fc39cc3db260071fca06206e1ccd2d398b460bb /IkiWiki
parenta66c693ee45d9d6cca75b7e5f3a4106b52d3509b (diff)
* Add mirrorlist plugin.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/mirrorlist.pm35
1 files changed, 35 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/mirrorlist.pm b/IkiWiki/Plugin/mirrorlist.pm
new file mode 100644
index 000000000..104587f3a
--- /dev/null
+++ b/IkiWiki/Plugin/mirrorlist.pm
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::mirrorlist;
+
+use warnings;
+use strict;
+use IkiWiki;
+
+sub import { #{{{
+ hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate);
+} # }}}
+
+sub pagetemplate (@) { #{{{
+ my %params=@_;
+ my $template=$params{template};
+
+ $template->param(extrafooter => mirrorlist($params{page}))
+ if $template->query(name => "extrafooter");
+} # }}}
+
+sub mirrorlist ($) { #{{{
+ my $page=shift;
+ return "<p>Mirror".
+ (keys %{$config{mirrorlist}} > 1 ? "s" : "").
+ ": ".
+ join(", ",
+ map {
+ qq{<a href="}.
+ $config{mirrorlist}->{$_}."/".$page.
+ qq{">$_</a>}
+ } keys %{$config{mirrorlist}}
+ ).
+ "</p>";
+} # }}}
+
+1