]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/version.pm
ensure state is dropped when a page stops embeddeding the version
[ikiwiki.git] / IkiWiki / Plugin / version.pm
index 0e8d7b5e71a03d3844e15c0b28540fcfb2794487..d39fd941966b35787c32910b988b938878de4792 100644 (file)
@@ -14,9 +14,16 @@ sub import { #{{{
 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};
+               if (exists $pagestate{$page}{version}{shown}) {
+                       if ($pagestate{$page}{version}{shown} ne $IkiWiki::version) {
+                               push @$needsbuild, $pagesources{$page};
+                       }
+                       if (grep { $_ eq $pagesources{$page} } @$needsbuild) {
+                               # remove state, will be re-added if
+                               # the version is still shown during the
+                               # rebuild
+                               delete $pagestate{$page}{version}{shown};
+                       }
                }
        }
 } # }}}