From 10045afa0996cb29eeefeca33917ecc55e2c5dbd Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Sun, 4 Nov 2018 15:45:54 +0100 Subject: [PATCH] initial support for marking up entries as events as well, mainly for trips/excursions --- nasg.py | 15 +++++++++++++++ templates/base.j2.html | 25 ++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/nasg.py b/nasg.py index 6649264..54da21a 100644 --- a/nasg.py +++ b/nasg.py @@ -510,6 +510,20 @@ class Singular(MarkdownDoc): else: return False + @property + def event(self): + if 'event' not in self.meta: + return False + + event = self.meta.get('event', {}) + event.update({ + 'startdate': arrow.get(event.get('start')).format(settings.dateformat.get('display')), + 'starttime': arrow.get(event.get('start')).format(settings.dateformat.get('iso')), + 'enddate': arrow.get(event.get('end')).format(settings.dateformat.get('display')), + 'endtime': arrow.get(event.get('end')).format(settings.dateformat.get('iso')), + }) + return event + @cached_property def tmplvars(self): v = { @@ -532,6 +546,7 @@ class Singular(MarkdownDoc): 'url': self.url, 'review': self.review, 'has_code': self.has_code, + 'event': self.event, } if (self.is_photo): v.update({ diff --git a/templates/base.j2.html b/templates/base.j2.html index 4ac49b6..0225c52 100644 --- a/templates/base.j2.html +++ b/templates/base.j2.html @@ -105,8 +105,13 @@ {% block content %} +{% if post.event %} + {% set mftype = 'h-entry h-event' %} +{% else %} + {% set mftype = 'h-entry' %} +{% endif %}
-
+

{% if post.is_reply %} @@ -166,6 +171,24 @@