X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/5023f2301d42319cb552102c532452b8fb4744af..245126ea49a72c5b021794757f7c172cce4e54f5:/IkiWiki/Plugin/calendar.pm?ds=sidebyside

diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index 91aff1ea7..aed087eed 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -34,25 +34,6 @@ sub import { #{{{
 	hook(type => "preprocess", id => "calendar", call => \&preprocess);
 } #}}}
 
-sub needsbuild (@) { #{{{
-	my $needsbuild=shift;
-	foreach my $page (keys %pagestate) {
-		if (exists $pagestate{$page}{calendar}{nextchange}) {
-			if ($pagestate{$page}{calendar}{nextchange} >= $time) {
-				# force a rebuild so the calendar shows
-				# the current day
-				push @$needsbuild, $pagesources{$page};
-			}
-			if (grep { $_ eq $pagesources{$page} } @$needsbuild) {
-				# remove state, will be re-added if
-				# the calendar is still there during the
-				# rebuild
-				delete $pagestate{$page}{calendar};
-			}
-		}
-	}
-} # }}}
-
 sub is_leap_year (@) { #{{{
 	my %params=@_;
 	return ($params{year} % 4 == 0 && (($params{year} % 100 != 0) || $params{year} % 400 == 0));
@@ -400,4 +381,24 @@ sub preprocess (@) { #{{{
 	return "\n<div><div class=\"calendar\">$calendar</div></div>\n";
 } #}}
 
+sub needsbuild (@) { #{{{
+	my $needsbuild=shift;
+	foreach my $page (keys %pagestate) {
+		if (exists $pagestate{$page}{calendar}{nextchange}) {
+			if ($pagestate{$page}{calendar}{nextchange} <= $time) {
+				# force a rebuild so the calendar shows
+				# the current day
+				push @$needsbuild, $pagesources{$page};
+			}
+			if (exists $pagesources{$page} && 
+			    grep { $_ eq $pagesources{$page} } @$needsbuild) {
+				# remove state, will be re-added if
+				# the calendar is still there during the
+				# rebuild
+				delete $pagestate{$page}{calendar};
+			}
+		}
+	}
+} # }}}
+
 1