]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
* Add mirrorlist plugin.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 23 Dec 2006 01:07:11 +0000 (01:07 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 23 Dec 2006 01:07:11 +0000 (01:07 +0000)
IkiWiki/Plugin/mirrorlist.pm [new file with mode: 0644]
debian/changelog
doc/ikiwiki.setup
doc/plugins/mirrorlist.mdwn [new file with mode: 0644]
templates/page.tmpl

diff --git a/IkiWiki/Plugin/mirrorlist.pm b/IkiWiki/Plugin/mirrorlist.pm
new file mode 100644 (file)
index 0000000..104587f
--- /dev/null
@@ -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
index a291dba6196836666f3ebae3509100c2585d0d28..f5008a2b7b468a83955167c59483732b518ae5f9 100644 (file)
@@ -1,3 +1,9 @@
+ikiwiki (1.37) UNRELEASED; urgency=low
+
+  * Add mirrorlist plugin.
+
+ -- Joey Hess <joeyh@debian.org>  Fri, 22 Dec 2006 19:54:41 -0500
+
 ikiwiki (1.36) unstable; urgency=low
 
   * Fix various links on the hyperestradier pages.
index d23010fd58bc9b92163d5bad4af0be3bb956ce9f..52b112a44c9e3430425788a6eb2b395f1ffc171d 100644 (file)
@@ -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 (file)
index 0000000..05d3dc9
--- /dev/null
@@ -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.
index 305e7793b482ed7729b94424bdaef3acefb9465c..fdf7502443c5f01f8f5d1113b2dbfa8347e33056 100644 (file)
@@ -80,6 +80,7 @@ Links:
 <span class="pageinfo">
 <!-- from <TMPL_VAR NAME=WIKINAME> -->
 Last edited <TMPL_VAR NAME=MTIME>
+<TMPL_IF EXTRAFOOTER><TMPL_VAR EXTRAFOOTER></TMPL_IF>
 </span>
 </div>