From: Joey Hess Date: Sun, 9 Dec 2007 00:05:01 +0000 (-0500) Subject: forgot to add X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/b4b452f4ee73fb67c6ff0aa761783def7483313b forgot to add --- diff --git a/IkiWiki/Plugin/version.pm b/IkiWiki/Plugin/version.pm new file mode 100644 index 000000000..0e8d7b5e7 --- /dev/null +++ b/IkiWiki/Plugin/version.pm @@ -0,0 +1,29 @@ +#!/usr/bin/perl +# Ikiwiki version plugin. +package IkiWiki::Plugin::version; + +use warnings; +use strict; +use IkiWiki 2.00; + +sub import { #{{{ + hook(type => "needsbuild", id => "version", call => \&needsbuild); + hook(type => "preprocess", id => "version", call => \&preprocess); +} # }}} + +sub needsbuild (@) { #{{{ + my $needsbuild=shift; + foreach my $page (keys %pagestate) { + if (exists $pagestate{$page}{version}{shown} && + $pagestate{$page}{version}{shown} ne $IkiWiki::version) { + push @$needsbuild, $pagesources{$page}; + } + } +} # }}} + +sub preprocess (@) { #{{{ + my %params=@_; + $pagestate{$params{destpage}}{version}{shown}=$IkiWiki::version; +} # }}} + +1 diff --git a/doc/plugins/version.mdwn b/doc/plugins/version.mdwn new file mode 100644 index 000000000..ec9062947 --- /dev/null +++ b/doc/plugins/version.mdwn @@ -0,0 +1,11 @@ +[[template id=plugin name=version author="[[Joey]]"]] +[[tag type/useful]] + +This plugin allows inserting the version of ikiwiki onto a page. + +Whenever ikiwiki is upgraded to a new version, the page will be rebuilt, +updating the version number. + +Use is simple: + + \[[version ]]