Return a month's calendar string (multi-line).
(self, theyear, themonth, w=0, l=0)
| 709 | ) |
| 710 | |
| 711 | def formatmonth(self, theyear, themonth, w=0, l=0): |
| 712 | """ |
| 713 | Return a month's calendar string (multi-line). |
| 714 | """ |
| 715 | if ( |
| 716 | self.highlight_day |
| 717 | and self.highlight_day.year == theyear |
| 718 | and self.highlight_day.month == themonth |
| 719 | ): |
| 720 | highlight_day = self.highlight_day.day |
| 721 | else: |
| 722 | highlight_day = None |
| 723 | w = max(2, w) |
| 724 | l = max(1, l) |
| 725 | s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1) |
| 726 | s = s.rstrip() |
| 727 | s += '\n' * l |
| 728 | s += self.formatweekheader(w).rstrip() |
| 729 | s += '\n' * l |
| 730 | for week in self.monthdays2calendar(theyear, themonth): |
| 731 | s += self.formatweek(week, w, highlight_day=highlight_day).rstrip() |
| 732 | s += '\n' * l |
| 733 | return s |
| 734 | |
| 735 | def formatyear(self, theyear, w=2, l=1, c=6, m=3): |
| 736 | """ |
nothing calls this directly
no test coverage detected