sipb-www
/
ikiwiki.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
22737e5
)
year calendar: only link to months that have posts
author
Joey Hess
<joey@gnu.kitenet.net>
Mon, 12 Oct 2009 18:19:04 +0000
(14:19 -0400)
committer
Joey Hess
<joey@gnu.kitenet.net>
Mon, 12 Oct 2009 18:19:04 +0000
(14:19 -0400)
This does mean the year calendars depend on existence of all posts made in
the year and have to be updated.
IkiWiki/Plugin/calendar.pm
patch
|
blob
|
history
diff --git
a/IkiWiki/Plugin/calendar.pm
b/IkiWiki/Plugin/calendar.pm
index d5a80795a1aee782f75b4ba266bed13d56e7ce50..ddcd1a82350d0058a1c22e4abd99297adb059773 100644
(file)
--- a/
IkiWiki/Plugin/calendar.pm
+++ b/
IkiWiki/Plugin/calendar.pm
@@
-242,6
+242,20
@@
EOF
sub format_year (@) {
my %params=@_;
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";
my $calendar="\n";
@@
-313,7
+327,8
@@
EOF
$tag = 'year-calendar-month-nolink';
}
$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,
$murl = htmllink($params{page}, $params{destpage},
"$archivebase/$params{year}/$mtag",
noimageinline => 1,