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.)
master
Joey Hess 2009-01-07 15:48:07 -05:00
parent e1e1d37753
commit 81b088866b
7 changed files with 77 additions and 0 deletions

View File

@ -22,6 +22,7 @@ my @bundle=qw{
template
toc
toggle
repolist
};
sub import {

View File

@ -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

3
debian/changelog vendored
View File

@ -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

View File

@ -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.

View File

@ -24,5 +24,6 @@ Currently included:
* [[template]]
* [[toc]]
* [[toggle]]
* [[repolist]]
New plugins will be added to this bundle from time to time.

View File

@ -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).

View File

@ -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>