summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2007-12-08 19:05:01 -0500
committerJoey Hess <joey@kitenet.net>2007-12-08 19:05:01 -0500
commitb4b452f4ee73fb67c6ff0aa761783def7483313b (patch)
tree7e264eca2caa3322344192ab1f9fe29e0495a442 /IkiWiki
parentfd6d85aa7995d90956d1ddc95b7d7517f5ccd470 (diff)
forgot to add
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/version.pm29
1 files changed, 29 insertions, 0 deletions
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