diff options
-rw-r--r-- | scripts/get_calendar.py | 2 | ||||
-rw-r--r-- | template/calendar.j2 | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/scripts/get_calendar.py b/scripts/get_calendar.py index b0bc186..948db0e 100644 --- a/scripts/get_calendar.py +++ b/scripts/get_calendar.py @@ -56,11 +56,13 @@ def get_events(calendar, after, before): for occurence in rrule.between(after, before, True): event_info['start'] = occurence event_info['end'] = occurence + duration + event_info['recurring'] = True yield copy.deepcopy(event_info) else: if start >= after: event_info['start'] = start event_info['end'] = end + event_info['recurring'] = False yield event_info class DatetimeEncoder(json.JSONEncoder): diff --git a/template/calendar.j2 b/template/calendar.j2 index 1e3efeb..8e993a6 100644 --- a/template/calendar.j2 +++ b/template/calendar.j2 @@ -1,9 +1,14 @@ <div class="calendar-listing {{ class }}"> {%- for event in events %} - <p><span class="date"> + {%- if event.recurring %} + <p class="recurring"> + {%- else %} + <p class="onetime"> + {%- endif -%} + <span class="date"> {%- if event.multiday %} - {{- event.start.strftime('%d. %B %Y').decode('utf-8') }} - {{ event.end.strftime('%d. %B %Y').decode('utf-8') }} - {%- else %}{{ event.start.strftime('%d. %B %Y, %H:%M Uhr').decode('utf-8') }} + {{- event.start.strftime('%A, %d. %B %Y').decode('utf-8') }} - {{ event.end.strftime('%A, %d. %B %Y').decode('utf-8') }} + {%- else %}{{ event.start.strftime('%A, d. %B %Y, %H:%M Uhr').decode('utf-8') }} {%- endif -%} </span> <span class="name">{{ event.name }}</span></p> <div> |