aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/version.pm
blob: 0e8d7b5e71a03d3844e15c0b28540fcfb2794487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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