<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::repolist;

use warnings;
use strict;
use IkiWiki 3.00;

sub import {
	hook(type =&gt; "getsetup", id =&gt; "repolist",  call =&gt; \&amp;getsetup);
	hook(type =&gt; "checkconfig", id =&gt; "repolist", call =&gt; \&amp;checkconfig);
}

sub getsetup () {
	return
		plugin =&gt; {
			safe =&gt; 1,
			rebuild =&gt; undef,
			section =&gt; "web",
		},
		repositories =&gt; {
			type =&gt; "string",
			example =&gt; ["svn://svn.example.org/wiki/trunk"],
			description =&gt; "URIs of repositories containing the wiki's source",
			safe =&gt; 1,
			rebuild =&gt; undef,
		},
}

my $relvcs;

sub checkconfig () {
	if (defined $config{rcs} &amp;&amp; $config{repositories}) {
		$relvcs=join("\n", map {
			s/"//g; # avoid quotes just in case
			qq{&lt;link rel="vcs-$config{rcs}" href="$_" title="wiki $config{rcs} repository" /&gt;}
		} @{$config{repositories}});
		
		hook(type =&gt; "pagetemplate", id =&gt; "repolist", call =&gt; \&amp;pagetemplate);
	}
}

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

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