]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/calendar.pm
response
[git.ikiwiki.info.git] / IkiWiki / Plugin / calendar.pm
index 91aff1ea7db017277aa374e5b4777474808b3896..4bb4c2c2192ef857b61da9e63608dce2b58b5020 100644 (file)
@@ -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,23 @@ 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 (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