--- CalendarPlugin.pm.dist 2007-11-27 18:09:34.000000000 +1300 +++ CalendarPlugin.pm 2007-11-27 18:59:29.000000000 +1300 @@ -543,6 +543,7 @@ local $years_rx = '[12][0-9][0-9][0-9]'; local $date_rx = "($days_rx)\\s+($months_rx)"; local $monthly_rx = "([1-6L])\\s+($wdays_rx)"; + local $monthly_workday_rx = "(W)\\s+($days_rx)"; local $full_date_rx = "$date_rx\\s+($years_rx)"; local $anniversary_date_rx = "A\\s+$date_rx\\s+($years_rx)"; local $weekly_rx = "E\\s+($wdays_rx)"; @@ -700,6 +701,37 @@ &TWiki::Func::writeWarning( "$pluginName: $@ " ) if $@ && $debug; } + # collect monthly workday repeaters + @days = fetchDays( "$monthly_workday_rx", \@bullets ); + foreach $d (@days) { +# &TWiki::Func::writeWarning( "$pluginName: checking working day rule $d" ); + ($nn, $dd, $xs, $xcstr, $descr) = split( /\|/, $d); + eval { + if (length($xcstr) > 9) { + @xmap = &fetchxmap($xcstr, $y, $m); + } else { + @xmap = &emptyxmap($y, $m); + } + $nn = $dd; + $hd = 0; +# &TWiki::Func::writeWarning( "$pluginName: looking for $nn th working day" ); + do { + $hd++; +# &TWiki::Func::writeWarning( "$pluginName: checking day $hd" ); + if (Day_of_Week($y, $m, $hd) < 6) { +# &TWiki::Func::writeWarning( "$pluginName: day $hd is a weekday" ); + $nn--; + } + } until ($nn == 0); +# &TWiki::Func::writeWarning( "$pluginName: target day is $hd" ); + if ($hd <= Days_in_Month($y, $m) && $xmap[$hd]) { + &highlightDay( $cal, $hd, $descr, %options ); + } + }; + &TWiki::Func::writeWarning( "$pluginName: $@ " ) if $@ && $debug; + } + + # collect weekly repeaters with start and end dates @days = fetchDays( "$weekly_rx\\s+$full_date_rx\\s+-\\s+$full_date_rx", \@bullets ); foreach $d (@days) {