<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
package IkiWiki::Plugin::mirrorlist;

use warnings;
use strict;
use IkiWiki;

sub import { #{{{
	hook(type =&gt; "pagetemplate", id =&gt; "mirrorlist", call =&gt; \&amp;pagetemplate);
} # }}}

sub pagetemplate (@) { #{{{
	my %params=@_;
        my $template=$params{template};
	
	$template-&gt;param(extrafooter =&gt; mirrorlist($params{page}))
		if $template-&gt;query(name =&gt; "extrafooter");
} # }}}

sub mirrorlist ($) { #{{{
	my $page=shift;
	return "&lt;p&gt;".
		(keys %{$config{mirrorlist}} &gt; 1 ? gettext("Mirrors") : gettext("Mirror")).
		": ".
		join(", ",
			map { 
				qq{&lt;a href="}.
				$config{mirrorlist}-&gt;{$_}."/".$page.
				qq{"&gt;$_&lt;/a&gt;}
			} keys %{$config{mirrorlist}}
		).
		"&lt;/p&gt;";
} # }}}

1
</pre></body></html>