#import calendar,os,re
#from template import dehtml, xmlchars
#from get import resize
#if $os.environ.get('HTTP_ACCEPT', '').find('application/xhtml+xml') > -1
Content-type: application/xhtml+xml; charset=utf-8
#else
Content-type: text/html; charset=utf-8
#end if
X-Pingback: $service.pingback
#set $year = $int($path[0])
#set $month = $int($path[1])
#set date=[$year, $month, 1, 0,0,0, 0,1,0]
#set title=$calendar.month_name[$month] + ' ' + $str($year)
$channel.title: $title
##
## sort by day
##
#set dayentries = {}
#for $child in $children
#set $localtime = $time.localtime($calendar.timegm($child.mtime))
#if $list($localtime[0:2])==$date[0:2]
#set $day = $localtime[2]
#set $dayentries[$day]=$dayentries.get($day,[]) + [$child]
#end if
#end for
##
$xmlchars($channel.description)
$calendar.setfirstweekday(calendar.SUNDAY)
$title
#for $day in [6]+range(0,6)
| $calendar.day_name[$day] |
#end for
#for $week in $calendar.monthcalendar($year,$month)
#for $date[2] in $week
#if $date[2] in $dayentries
$date[2]
#for $child in $dayentries[$date[2]]
#set $title = $child.title or " ".join($dehtml($child.description).split()[0:6])
#if $title.find('<')<0
#set $title = $re.sub('([^\s\w."\'])(\w)', r'\1\2', $title)
#end if
#set $svg = $child.description[$child.description.find(' |
#end for
#end for
#set $prev = $time.localtime($time.mktime([$year, $month, 0, 0,0,0, 0,0,0]))
#set $next = $time.localtime($time.mktime([$year, $month+1, 1, 0,0,0, 0,0,0]))