aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-01-07 15:48:07 -0500
committerJoey Hess <joey@gnu.kitenet.net>2009-01-07 16:07:46 -0500
commit81b088866be5f55433c12e09c90e2ae404a8ed89 (patch)
treeeab3289e160892873ceb3b39cd327f40e9062b71 /IkiWiki
parente1e1d37753d357acc6e1128594ea8704777658ff (diff)
downloadikiwiki-81b088866be5f55433c12e09c90e2ae404a8ed89.tar
ikiwiki-81b088866be5f55433c12e09c90e2ae404a8ed89.tar.gz
repolist: New plugin to support the rel=vcs-* microformat.
* repolist: New plugin to support the rel=vcs-* microformat. * goodstuff: Include repolist by default. (But it does nothing until configured with the repository locations.)
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/goodstuff.pm1
-rw-r--r--IkiWiki/Plugin/repolist.pm51
2 files changed, 52 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/goodstuff.pm b/IkiWiki/Plugin/goodstuff.pm
index 46f2380cf..451cd6f84 100644
--- a/IkiWiki/Plugin/goodstuff.pm
+++ b/IkiWiki/Plugin/goodstuff.pm
@@ -22,6 +22,7 @@ my @bundle=qw{
template
toc
toggle
+ repolist
};
sub import {
diff --git a/IkiWiki/Plugin/repolist.pm b/IkiWiki/Plugin/repolist.pm
new file mode 100644
index 000000000..f69ec3988
--- /dev/null
+++ b/IkiWiki/Plugin/repolist.pm
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::repolist;
+
+use warnings;
+use strict;
+use IkiWiki 3.00;
+
+sub import {
+ hook(type => "getsetup", id => "repolist", call => \&getsetup);
+ hook(type => "checkconfig", id => "repolist", call => \&checkconfig);
+}
+
+sub getsetup () {
+ return
+ plugin => {
+ safe => 1,
+ rebuild => undef,
+ },
+ repositories => {
+ type => "string",
+ example => ["svn://svn.example.org/wiki/trunk"],
+ description => "URIs of repositories containing the wiki's source",
+ safe => 1,
+ rebuild => undef,
+ },
+}
+
+my $relvcs;
+
+sub checkconfig () {
+ if (defined $config{rcs} && $config{repositories}) {
+ $relvcs=join("\n", map {
+ s/"//g; # avoid quotes just in case
+ qq{<link rel="vcs-$config{rcs}" href="$_" title="wiki $config{rcs} repository" />}
+ } @{$config{repositories}});
+
+ hook(type => "pagetemplate", id => "repolist", call => \&pagetemplate);
+ }
+}
+
+sub pagetemplate (@) {
+ my %params=@_;
+ my $page=$params{page};
+ my $template=$params{template};
+
+ if (defined $relvcs && $template->query(name => "relvcs")) {
+ $template->param(relvcs => $relvcs);
+ }
+}
+
+1