aboutsummaryrefslogtreecommitdiff
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
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.)
-rw-r--r--IkiWiki/Plugin/goodstuff.pm1
-rw-r--r--IkiWiki/Plugin/repolist.pm51
-rw-r--r--debian/changelog3
-rw-r--r--doc/pagehistory.mdwn3
-rw-r--r--doc/plugins/goodstuff.mdwn1
-rw-r--r--doc/plugins/repolist.mdwn17
-rw-r--r--templates/page.tmpl1
7 files changed, 77 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
diff --git a/debian/changelog b/debian/changelog
index f4f9df041..74556906e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ ikiwiki (3.02) UNRELEASED; urgency=low
* table: Find links in external files in scan pass.
* rename: Show full names of affected pages.
* comments: Fix cache avoidance hack.
+ * repolist: New plugin to support the rel=vcs-* microformat.
+ * goodstuff: Include repolist by default. (But it does nothing until
+ configured with the repository locations.)
-- Joey Hess <joeyh@debian.org> Tue, 06 Jan 2009 15:02:52 -0500
diff --git a/doc/pagehistory.mdwn b/doc/pagehistory.mdwn
index fc2a3f543..465062736 100644
--- a/doc/pagehistory.mdwn
+++ b/doc/pagehistory.mdwn
@@ -3,3 +3,6 @@ revison history of a page. This is enabled by the `historyurl` setting,
which is used to specify the URL to a web interface such as [[ViewVC]]
(for Subversion) or [[Gitweb]]. In that url, "\[[file]]" is replaced with
the name of the file to view.
+
+The [[plugins/repolist]] plugin can suppliment this information with
+urls to the underlying repository of the wiki.
diff --git a/doc/plugins/goodstuff.mdwn b/doc/plugins/goodstuff.mdwn
index ed57c0f01..ee1bffcfa 100644
--- a/doc/plugins/goodstuff.mdwn
+++ b/doc/plugins/goodstuff.mdwn
@@ -24,5 +24,6 @@ Currently included:
* [[template]]
* [[toc]]
* [[toggle]]
+* [[repolist]]
New plugins will be added to this bundle from time to time.
diff --git a/doc/plugins/repolist.mdwn b/doc/plugins/repolist.mdwn
new file mode 100644
index 000000000..9b3a7575e
--- /dev/null
+++ b/doc/plugins/repolist.mdwn
@@ -0,0 +1,17 @@
+[[!template id=plugin name=repolist author="[[Joey]]"]]
+[[!tag type/useful]]
+
+This plugin allows you to configure ikiwiki with the location of
+[[rcs]] repositories for your wiki's source. This is done via the
+"repositories" setting in the setup file. Once you tell it where the source
+to your wiki can be downloaded from, this information can be published on
+your wiki in various ways.
+
+This plugin supports the [rel-vcs-*](http://kitenet.net/~joey/rfc/rel-vcs/)
+microformat, and uses it to embed the repository location information in
+every wiki page.
+
+By using this plugin, you will make [[Joey]] very happy, as he will be able
+to easily check out the source of your wiki, for purposes of debugging and
+general curiosity. More generally, making it easy for others to find the
+repository for your wiki is just a Plain Good Idea(TM).
diff --git a/templates/page.tmpl b/templates/page.tmpl
index f75491127..29ba688c7 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -13,6 +13,7 @@
<link rel="alternate" type="application/x-wiki" title="Edit this page" href="<TMPL_VAR EDITURL>" />
</TMPL_IF>
<TMPL_IF NAME="FEEDLINKS"><TMPL_VAR FEEDLINKS></TMPL_IF>
+<TMPL_IF NAME="RELVCS"><TMPL_VAR RELVCS></TMPL_IF>
<TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>
</head>
<body>