response
[ikiwiki.git] / IkiWiki / Plugin / repolist.pm
blobba7c5f0aa0e895087d9d1cba08d031cd29bc8764
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::repolist;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9 hook(type => "getsetup", id => "repolist", call => \&getsetup);
10 hook(type => "checkconfig", id => "repolist", call => \&checkconfig);
13 sub getsetup () {
14 return
15 plugin => {
16 safe => 1,
17 rebuild => undef,
18 section => "web",
20 repositories => {
21 type => "string",
22 example => ["svn://svn.example.org/wiki/trunk"],
23 description => "URIs of repositories containing the wiki's source",
24 safe => 1,
25 rebuild => undef,
29 my $relvcs;
31 sub checkconfig () {
32 if (defined $config{rcs} && $config{repositories}) {
33 $relvcs=join("\n", map {
34 s/"//g; # avoid quotes just in case
35 qq{<link rel="vcs-$config{rcs}" href="$_" title="wiki $config{rcs} repository" />}
36 } @{$config{repositories}});
38 hook(type => "pagetemplate", id => "repolist", call => \&pagetemplate);
42 sub pagetemplate (@) {
43 my %params=@_;
44 my $page=$params{page};
45 my $template=$params{template};
47 if (defined $relvcs && $template->query(name => "relvcs")) {
48 $template->param(relvcs => $relvcs);