From: joey Date: Sat, 23 Dec 2006 01:07:11 +0000 (+0000) Subject: * Add mirrorlist plugin. X-Git-Tag: 1.37~128 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/d83d11e6b87e718872e72153ee6bb3a382615c25 * Add mirrorlist plugin. --- 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 diff --git a/debian/changelog b/debian/changelog index a291dba61..f5008a2b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ikiwiki (1.37) UNRELEASED; urgency=low + + * Add mirrorlist plugin. + + -- Joey Hess Fri, 22 Dec 2006 19:54:41 -0500 + ikiwiki (1.36) unstable; urgency=low * Fix various links on the hyperestradier pages. diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index d23010fd5..52b112a44 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -111,4 +111,10 @@ use IkiWiki::Setup::Standard { # For use with the openid plugin, to give an url to a page users # can use to signup for an OpenID. #openidsignup => "http://myopenid.com/", + + # For use with the mirrorlist plugin, a list of mirrors. + #mirrorlist => { + # mirror1 => "http://hostname1", + # mirror2 => "http://hostname2/mirror", + #}, } diff --git a/doc/plugins/mirrorlist.mdwn b/doc/plugins/mirrorlist.mdwn new file mode 100644 index 000000000..05d3dc910 --- /dev/null +++ b/doc/plugins/mirrorlist.mdwn @@ -0,0 +1,8 @@ +[[template id=plugin name=mirror included=1 author="[[Joey]]"]] +[[tag type/special-purpose]] + +This plugin allows adding links a list of mirrors to each page in the +wiki. For each mirror, a name and an url should be specified. Pages are +assumed to exist in the same location under the specified url on each +mirror. The [[ikiwiki.setup]] file has an example of configuring a list of +mirrors. diff --git a/templates/page.tmpl b/templates/page.tmpl index 305e7793b..fdf750244 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -80,6 +80,7 @@ Links: Last edited +