% Teaching calendar for \VAR{period} \VAR{year}. \BLOCK{for week, date in weeks.items()} \BLOCK{set eow = (date + eow_offset)} \newcommand{ \BLOCK{- if date|isteaching -} \VAR{period_name}Week\VAR{week|num2words} \BLOCK{- elif date|isbreak -} \VAR{period_name}Break \BLOCK{- else -} WTF \BLOCK{- endif -} }{ \BLOCK{- if date.month == eow.month -} \VAR{date.strftime("%d")}--\VAR{eow.strftime("%d")} \\ \VAR{date.strftime("%b")} \BLOCK{- else -} \VAR{date.strftime("%d %b")} \\ --\VAR{eow.strftime("%d %b")} \BLOCK{- endif -} } \BLOCK{endfor}