changeset 1590d0f4154d in www.tryton.org:default
details: https://hg.tryton.org/www.tryton.org?cmd=changeset;node=1590d0f4154d
description:
Follow microformats standard and add compatibility to microformats2
diffstat:
app.py | 14 ++++++++++----
templates/events/layout.html | 27 +++++++++++++++++----------
templates/events/tum2019.html | 31 ++++++++++++++++++-------------
3 files changed, 45 insertions(+), 27 deletions(-)
diffs (162 lines):
diff -r 2f74a1ad7085 -r 1590d0f4154d app.py
--- a/app.py Fri Jul 12 10:36:35 2019 +0200
+++ b/app.py Sat Jul 13 14:23:13 2019 +0200
@@ -333,23 +333,27 @@
@cache.cached()
def event(event):
class Day:
- def __init__(self, date, *events, full=False):
+ def __init__(self, date, *events, location=None, full=False):
if not isinstance(date, datetime.date):
date = datetime.date(*date)
self.date = date
self.full = full
+ self.location = location
self.events = []
for event in events:
self.add(*event)
- def add(self, summary, start, end, *args):
+ def add(self, summary, start, end, *args, location=None):
if not isinstance(start, datetime.time):
start = datetime.time(*start)
if not isinstance(end, datetime.time):
end = datetime.time(*end)
start = datetime.datetime.combine(self.date, start)
end = datetime.datetime.combine(self.date, end)
- self.events.append(Event(summary, start, end, *args))
+ if not location:
+ location = self.location
+ self.events.append(Event(
+ summary, start, end, *args, location=location))
@property
def start(self):
@@ -362,10 +366,12 @@
return max(e.end for e in self.events)
class Event:
- def __init__(self, summary, start, end, description='', profiles=()):
+ def __init__(self, summary, start, end, description='', profiles=(),
+ location=None):
self.summary = summary
self.start = start
self.end = end
+ self.location = location
self.description = description
self.profiles = [Profile(*p) for p in profiles]
diff -r 2f74a1ad7085 -r 1590d0f4154d templates/events/layout.html
--- a/templates/events/layout.html Fri Jul 12 10:36:35 2019 +0200
+++ b/templates/events/layout.html Sat Jul 13 14:23:13 2019 +0200
@@ -41,28 +41,35 @@
{% if day.events %}
<ol class="list-group mx-auto">
{% for event in day.events %}
- <li class="vevent list-group-item">
+ <li class="h-event vevent list-group-item">
<div class="d-flex w-100 justify-content-between">
- <h4 class="summary">{{ event.summary }}</h4>
+ <h4 class="p-name summary">{{ event.summary }}</h4>
<small>
- <span class="dtstart" title="{{
event.start.strftime('%Y%m%dT%H%M%S') }}">{{ event.start.strftime('%H:%M')
}}</span>
+ <abbr class="dt-start dtstart" datetime="{{
event.start.strftime('%Y%m%dT%H%M%S') }}" title="{{
event.start.strftime('%Y%m%dT%H%M%S') }}">{{ event.start.strftime('%H:%M')
}}</abbr>
-
- <span class="dtend" title="{{
event.end.strftime('%Y%m%dT%H%M%S') }}">{{ event.end.strftime('%H:%M') }}</span>
+ <abbr class="dt-end dtend" datetime="{{
event.end.strftime('%Y%m%dT%H%M%S') }}" title="{{
event.end.strftime('%Y%m%dT%H%M%S') }}">{{ event.end.strftime('%H:%M') }}</abbr>
</small>
</div>
- <p class="description">
+ {% if event.description %}
+ <p class="p-summary description">
{{ event.description }}
</p>
- <div class="organizer d-flex justify-content-start">
+ {% endif %}
+ {% if event.profiles %}
+ <div class="p-attendee organizer d-flex
justify-content-start">
{% for profile in event.profiles %}
- <div class="vcard d-flex flex-wrap
justify-content-start align-items-start">
- <a class="url" href="//www.gravatar.com/{{
profile.gravatar }}">
- <img class="img-thumbnail photo"
src="//www.gravatar.com/avatar/{{ profile.gravatar }}?=48" alt="Avatar of {{
profile.name }}"/>
+ <div class="h-card vcard d-flex flex-wrap
justify-content-start align-items-start">
+ <a class="u-url url"
href="//www.gravatar.com/{{ profile.gravatar }}">
+ <img class="img-thumbnail u-photo photo"
src="//www.gravatar.com/avatar/{{ profile.gravatar }}?=48" alt="Avatar of {{
profile.name }}"/>
</a>
- <span class="fn m-1">{{ profile.name }}{% if
profile.company %},<br/><a class="org" href="{{ profile.url }}">{{
profile.company }}</a>{% endif %}</span>
+ <span class="p-name fn m-1">{{ profile.name
}}{% if profile.company %},<br/><a class="p-org org" href="{{ profile.url
}}">{{ profile.company }}</a>{% endif %}</span>
</div>
{% endfor %}
</div>
+ {% endif %}
+ {% if event.location %}
+ <div class="p-location location d-none">{{
event.location | safe }}</div>
+ {% endif %}
</li>
{% endfor %}
</ol>
diff -r 2f74a1ad7085 -r 1590d0f4154d templates/events/tum2019.html
--- a/templates/events/tum2019.html Fri Jul 12 10:36:35 2019 +0200
+++ b/templates/events/tum2019.html Sat Jul 13 14:23:13 2019 +0200
@@ -1,11 +1,24 @@
{% set title = "Unconference Marseille - June 4th-7th, 2019" %}
{% set logo = 'images/events/tum2019-logo.png' %}
{% set banner = 'tum2019-banner.svg' %}
+{% macro location() %}
+<div class="h-card vcard">
+ <strong class="p-name fn">
+ <a class="u-url url" href="http://www.emd-management.fr/en/">
+ École de Commerce et de Management
+ </a></strong><br/>
+ <span class="p-addr addr">
+ <span class="p-street-address street-address">Rue Joseph Biaggi -
CS 70329</span>,<br/>
+ <span class="p-postal-code postal-code">13331</span>
+ <span class="p-locality locality">Marseille</span><br/>
+ </span>
+</div>
+{% endmacro %}
{% set events = [
Day((2019, 6, 4),
- ("Code Sprint", (9,), (18,)), full=True),
+ ("Code Sprint", (9,), (18,)), location=location(), full=True),
Day((2019, 6, 5),
- ("Code Sprint", (9,), (18,)), full=True),
+ ("Code Sprint", (9,), (18,)), location=location(), full=True),
Day((2019, 6, 6),
("A tour of new Tryton's features", (9,), (12,),
"Presentation of new key features introduced in Tryton between 4.8
and 5.2.",
@@ -19,7 +32,7 @@
("Supporters Meeting", (17,), (18,),
"The annual meeting of Foundation's supporters.",
[]),
- ),
+ location=location()),
Day((2019, 6, 7),
("Building mobile applications connected to Tryton", (9,), (10,),
"How we developed an Android application which reads and writes
information to a Tryton server.",
@@ -37,7 +50,7 @@
("Lisp ERP", (16,), (17,),
"Programming modules for Tryton with Hy (embedded Lisp for
Python).",
[("Francesc Guillen", 'a0ef3bd08930d7f4891f891ec27d17a6',)]),
- ),
+ location=location()),
]
%}
{% extends "events/layout.html" %}
@@ -81,15 +94,7 @@
{% block venue %}
<div class="vcard text-center">The unconference will be hosted at the
-<address class="adr">
- <strong class="fn org url">
- <a href="http://www.emd-management.fr/en/">
- École de Commerce et de Management
- </a></strong><br/>
- <span class="street-address">Rue Joseph Biaggi - CS 70329</span>,<br/>
- <span class="postal-code">13331</span>
- <span class="locality">Marseille</span><br/>
-</address>
+ {{ location() | safe }}
</div>
<iframe height="500"
src="https://www.openstreetmap.org/export/embed.html?bbox=5.37457823753357%2C43.302074626344606%2C5.378113389015199%2C43.303889933242516&layer=mapnik&marker=43.30298228656913%2C5.3763458132743835"
style="width: 100%; border: 1px solid black; overflow: hidden; margin:
0"></iframe><br/><small><a
href="https://www.openstreetmap.org/?mlat=43.30298&mlon=5.37635#map=19/43.30298/5.37635">View
Larger Map</a></small>
<h3>Transportations</h3>