Return a month's calendar string (multi-line).
(self, theyear, themonth, w=0, l=0)
| 676 | ) |
| 677 | |
| 678 | def formatmonth(self, theyear, themonth, w=0, l=0): |
| 679 | """ |
| 680 | Return a month's calendar string (multi-line). |
| 681 | """ |
| 682 | if ( |
| 683 | self.highlight_day |
| 684 | and self.highlight_day.year == theyear |
| 685 | and self.highlight_day.month == themonth |
| 686 | ): |
| 687 | highlight_day = self.highlight_day.day |
| 688 | else: |
| 689 | highlight_day = None |
| 690 | w = max(2, w) |
| 691 | l = max(1, l) |
| 692 | s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1) |
| 693 | s = s.rstrip() |
| 694 | s += '\n' * l |
| 695 | s += self.formatweekheader(w).rstrip() |
| 696 | s += '\n' * l |
| 697 | for week in self.monthdays2calendar(theyear, themonth): |
| 698 | s += self.formatweek(week, w, highlight_day=highlight_day).rstrip() |
| 699 | s += '\n' * l |
| 700 | return s |
| 701 | |
| 702 | def formatyear(self, theyear, w=2, l=1, c=6, m=3): |
| 703 | """ |
nothing calls this directly
no test coverage detected