aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/calendar.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-10-12 14:19:04 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-10-12 14:19:04 -0400
commit5c78192435210cdb7792ed56b04c2ef24a2d2127 (patch)
tree6663d933ea81918a32c410491e28900084a2ad22 /IkiWiki/Plugin/calendar.pm
parent22737e53f1b0367bc9bfb8d7bcbfc4dcc08a81ae (diff)
downloadikiwiki-5c78192435210cdb7792ed56b04c2ef24a2d2127.tar
ikiwiki-5c78192435210cdb7792ed56b04c2ef24a2d2127.tar.gz
year calendar: only link to months that have posts
This does mean the year calendars depend on existence of all posts made in the year and have to be updated.
Diffstat (limited to 'IkiWiki/Plugin/calendar.pm')
-rw-r--r--IkiWiki/Plugin/calendar.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index d5a80795a..ddcd1a823 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -242,6 +242,20 @@ EOF
sub format_year (@) {
my %params=@_;
+
+ my @post_months;
+ foreach my $p (pagespec_match_list($params{page},
+ "creation_year($params{year}) and ($params{pages})",
+ # add presence dependencies to update
+ # year calendar's links to months when
+ # pages are added/removed
+ deptype => deptype("presence"))) {
+ my $mtime = $IkiWiki::pagectime{$p};
+ my @date = localtime($mtime);
+ my $month = $date[4] + 1;
+
+ $post_months[$month]++;
+ }
my $calendar="\n";
@@ -313,7 +327,8 @@ EOF
$tag = 'year-calendar-month-nolink';
}
- if ($pagesources{"$archivebase/$params{year}/$mtag"}) {
+ if ($pagesources{"$archivebase/$params{year}/$mtag"} &&
+ $post_months[$mtag]) {
$murl = htmllink($params{page}, $params{destpage},
"$archivebase/$params{year}/$mtag",
noimageinline => 1,