From d83d11e6b87e718872e72153ee6bb3a382615c25 Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 23 Dec 2006 01:07:11 +0000 Subject: * Add mirrorlist plugin. --- IkiWiki/Plugin/mirrorlist.pm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 IkiWiki/Plugin/mirrorlist.pm (limited to 'IkiWiki') 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 "

Mirror". + (keys %{$config{mirrorlist}} > 1 ? "s" : ""). + ": ". + join(", ", + map { + qq{$_} + } keys %{$config{mirrorlist}} + ). + "

"; +} # }}} + +1 -- cgit v1.2.3