]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/version.pm
Merge commit 'origin/master'
[git.ikiwiki.info.git] / IkiWiki / Plugin / version.pm
index d39fd941966b35787c32910b988b938878de4792..18e9613aee76fd51e04681128af8646dab916963 100644 (file)
@@ -7,10 +7,19 @@ use strict;
 use IkiWiki 2.00;
 
 sub import { #{{{
 use IkiWiki 2.00;
 
 sub import { #{{{
+       hook(type => "getsetup", id => "version", call => \&getsetup);
        hook(type => "needsbuild", id => "version", call => \&needsbuild);
        hook(type => "preprocess", id => "version", call => \&preprocess);
 } # }}}
 
        hook(type => "needsbuild", id => "version", call => \&needsbuild);
        hook(type => "preprocess", id => "version", call => \&preprocess);
 } # }}}
 
+sub getsetup () { #{{{
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+} #}}}
+
 sub needsbuild (@) { #{{{
        my $needsbuild=shift;
        foreach my $page (keys %pagestate) {
 sub needsbuild (@) { #{{{
        my $needsbuild=shift;
        foreach my $page (keys %pagestate) {
@@ -18,7 +27,8 @@ sub needsbuild (@) { #{{{
                        if ($pagestate{$page}{version}{shown} ne $IkiWiki::version) {
                                push @$needsbuild, $pagesources{$page};
                        }
                        if ($pagestate{$page}{version}{shown} ne $IkiWiki::version) {
                                push @$needsbuild, $pagesources{$page};
                        }
-                       if (grep { $_ eq $pagesources{$page} } @$needsbuild) {
+                       if (exists $pagesources{$page} &&
+                           grep { $_ eq $pagesources{$page} } @$needsbuild) {
                                # remove state, will be re-added if
                                # the version is still shown during the
                                # rebuild
                                # remove state, will be re-added if
                                # the version is still shown during the
                                # rebuild