X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/c8cb931890cb9ff614683eef27fc0bfeb308d8bd..24bfc3fdc52fd55703c6b618b768cfb0905456d3:/IkiWiki/Plugin/calendar.pm

diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index 4bb4c2c21..6d536a91b 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -30,10 +30,26 @@ my $time=time;
 my @now=localtime($time);
 
 sub import { #{{{
-	hook(type => "needsbuild", id => "version", call => \&needsbuild);
+	hook(type => "getsetup", id => "calendar", call => \&getsetup);
+	hook(type => "needsbuild", id => "calendar", call => \&needsbuild);
 	hook(type => "preprocess", id => "calendar", call => \&preprocess);
 } #}}}
 
+sub getsetup () { #{{{
+	return
+		plugin => {
+			safe => 1,
+			rebuild => undef,
+		},
+		archivebase => {
+			type => "string",
+			example => "archives",
+			description => "base of the archives hierarchy",
+			safe => 1,
+			rebuild => 1,
+		},
+} #}}}
+
 sub is_leap_year (@) { #{{{
 	my %params=@_;
 	return ($params{year} % 4 == 0 && (($params{year} % 100 != 0) || $params{year} % 400 == 0));
@@ -390,7 +406,8 @@ sub needsbuild (@) { #{{{
 				# the current day
 				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 calendar is still there during the
 				# rebuild