--- CalendarPlugin.pm 2006/11/03 04:49:52 1.1 +++ CalendarPlugin.pm 2006/11/03 05:02:26 1.2 @@ -374,7 +374,11 @@ my $asList = scalar &TWiki::Func::extractNameValuePair( $attributes, 'aslist' ); + my $maxListDays; + if ($asList) { + $maxListDays = scalar &TWiki::Func::extractNameValuePair( $attributes, + 'maxlistdays' ); # If displaying as a list, force showdatenumbers to 1 so that the # Plugin can format them later. This logic seems backwards, but @@ -479,6 +483,7 @@ # Loop, displaying one month at a time for the number of months # requested. + month: while (($y < $lastYear) || (($y <= $lastYear) && ($m <= $lastMonth))) { my $cal = new HTML::CalendarMonthSimple(month => $m, year => $y, today_year => $currentYear, @@ -875,6 +880,7 @@ $numDays = Days_in_Month($cal->year(), $cal->month()) - $cal->today_date() + 1; } my $day = $listStartDay; + my $dayCount = 0; while ($numDays > 0) { if ($day > Days_in_Month($cal->year(), $cal->month())) { @@ -895,9 +901,12 @@ $result .= &formatDateNumber($cal, $day, %options); } $result .= $content; + if ($maxListDays && ++$dayCount >= $maxListDays) { + last month; + } } $day++; - $numDays--; + last month if (! --$numDays); } }