diff options
-rw-r--r-- | scripts/calendar_plugin.py | 3 | ||||
-rw-r--r-- | template/calendar_head.j2 | 8 |
2 files changed, 4 insertions, 7 deletions
diff --git a/scripts/calendar_plugin.py b/scripts/calendar_plugin.py index af7408b..c277a9f 100644 --- a/scripts/calendar_plugin.py +++ b/scripts/calendar_plugin.py @@ -31,7 +31,8 @@ class CalendarPlugin: def _get_calendar_head(self): return self.template_env.get_template('calendar_head.j2').render({ 'events': self.events, - 'class': 'calendar-head' + 'class': 'calendar-head', + 'cutoff': datetime.now() + timedelta(days=7) }).encode('utf-8') def process_content(self, page_content): diff --git a/template/calendar_head.j2 b/template/calendar_head.j2 index d8df951..17bc58e 100644 --- a/template/calendar_head.j2 +++ b/template/calendar_head.j2 @@ -1,10 +1,6 @@ <div class="calendar-listing {{ class }}"> -{%- for event in events[:7] %} +{%- for event in events %} +{%- if event.start <= cutoff or not event.recurring %} {% include 'calendar_event.j2' %} {%- endfor %} -{%- for event in events[7:] %} - {% if not event.recurring %} - {% include 'calendar_event.j2' %} - {% endif %} -{%- endfor %} </div> |