3 I am copying stuff discussed in the [[forum|/forum/Calendar:_listing_multiple_entries_per_day]], since the [[patch]] only list pages that are todo or bugs.
5 If there are several pages created on the same date, the [[calendar directive|/ikiwiki/directive/calendar]] only display the first one.
8 - if there is a single entry in one day, does not change anything (compared to the previous version of the calendar plugin);
9 - if there are several entries, when mouse passes over the day, displays a popup listing all the entries of that day.
11 That's all. No new pages for each day, takes as little space as it took before, and only a few lines more in the source.
13 The only thing I am not totally happy with is the CSS. We have to say that the text is aligned on the left (otherwise, it is aligned on the right, as is each day of the calendar), but I do not know which place is the more sensible to put that line of CSS in.
19 diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
20 index d443198..2c9ed79 100644
21 --- a/IkiWiki/Plugin/calendar.pm
22 +++ b/IkiWiki/Plugin/calendar.pm
23 @@ -86,8 +86,11 @@ sub format_month (@) {
24 my $year = $date[5] + 1900;
25 my $mtag = sprintf("%02d", $month);
27 - # Only one posting per day is being linked to.
28 - $linkcache{"$year/$mtag/$mday"} = $p;
29 + # Several postings per day
30 + if (! $linkcache{"$year/$mtag/$mday"}) {
31 + $linkcache{"$year/$mtag/$mday"} = [];
33 + push(@{$linkcache{"$year/$mtag/$mday"}}, $p);
36 my $pmonth = $params{month} - 1;
37 @@ -221,11 +224,36 @@ EOF
38 $tag='month-calendar-day-link';
40 $calendar.=qq{\t\t<td class="$tag $downame{$wday}">};
41 - $calendar.=htmllink($params{page}, $params{destpage},
45 - title => pagetitle(IkiWiki::basename($linkcache{$key})));
46 + if ( scalar(@{$linkcache{$key}}) == 1) {
47 + # Only one posting on this page
48 + my $page = $linkcache{$key}[0];
49 + $calendar.=htmllink($params{page}, $params{destpage},
53 + title => pagetitle(IkiWiki::basename($page)));
55 + $calendar.=qq{<div class='popup'>$day<div class='balloon'>};
56 + # Several postings on this page
57 + $calendar.=qq{<ul>};
58 + foreach my $page (@{$linkcache{$key}}) {
59 + $calendar.= qq{\n\t\t\t<li>};
61 + if (exists $pagestate{$page}{meta}{title}) {
62 + $title = "$pagestate{$page}{meta}{title}";
64 + $title = pagetitle(IkiWiki::basename($page));
66 + $calendar.=htmllink($params{page}, $params{destpage},
71 + $calendar.= '</li>';
73 + $calendar.=qq{\n\t\t</ul>};
74 + $calendar.=qq{</div></div>};
76 $calendar.=qq{</td>\n};
79 diff --git a/doc/style.css b/doc/style.css
82 index 424d438..b52c72b
85 @@ -323,6 +323,7 @@ div.progress-done {
91 .popup:hover .balloon,
92 .popup:focus .balloon {
94 > [[applied|done]] --[[Joey]]