Branch: Tag:

1999-05-30

1999-05-30 20:29:47 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

docfix

Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.20
Rev: lib/modules/Calendar.pmod/module.pmod:1.4

198:    if (!month) // resolv thing here is to avoid compile-time resolve    month=master()->resolv("Calendar")["Gregorian"]["Month"]();    -  today=function_object(object_program(month))->Day(); +  options=(["mark_today":1, +  "week_space":3, +  "weeks":1, +  "days":1, +  "title":1, +  "notes":([])]) | (options || ([])); +  options=(["date_space":(options->mark_today?3:2)])|options;    -  res=sprintf(" %|28s\n", -  String.capitalize(month->name()+" ") -  +month->year()->name()); +     -  +  today=function_object(object_program(month))->Day(); +     w=month->day(1)->week();    -  res+=" "; +  res=""; +  if (options->weeks) res+=" "+" "*options->week_space; +  if (options->title) +  res+=sprintf("%|*s\n", +  (1+options->date_space)*sizeof(w->days())-1, +  intp(options->title) +  ?(String.capitalize(month->name()+" ") +  +month->year()->name()) +  :options->title); +  +  if (options->days) +  { +  if (options->weeks) res+=" "+" "*options->week_space;    foreach (Array.map(w->days(),w->day)->week_day_name(),string n) -  res+=sprintf("%3s ",n[0..2]); +  res+=sprintf("%*s ",options->date_space,n[0..options->date_space-1]);    res+="\n"; -  +  }    -  +  string daynotes=""; +  +  if (sizeof(Array.filter( +  Array.map(month->days(),month->day), +  lambda(object d) { return !!options->notes[d]; }))) +  daynotes="\n%-|"+options->date_space+"s"; +     do    {    array a; -  +  array b;    object d; -  +  string format=""; +     a=Array.map(Array.map(w->days(),w->day),    lambda(object d)    { if (d->month()!=month) return 0; else return d; });    -  res+=sprintf("%3s ",w->name()); +  if (options->weeks) +  res+=sprintf("%*s ",options->week_space,w->name());    foreach (a,d)    if (d) -  if (d!=today) res+=sprintf(" %2d ",d->month_day()); -  else res+=sprintf(">%2d<",d->month_day()); -  else res+=" "; +  if (!options->mark_today || d!=today) +  res+=sprintf("%* |d ", +  options->date_space, +  d->month_day()); +  else +  res+=sprintf(">%* |d<", +  options->date_space-1, +  d->month_day()); +  else res+=" "+" "*options->date_space;    -  +  if (options->notes[w]) +  res+=sprintf("%-=*s", +  options->week_note_column_width, +  options->notes[w]); +     res+="\n"; -  +  +  if (daynotes) +  { +  +  } +     w++;    }    while (w->day(0)->month()==month);       return res;   }