Merge "Add 'draft' banner and show events status in timeline"

This commit is contained in:
Jenkins 2016-03-11 03:46:20 +00:00 committed by Gerrit Code Review
commit f526acec43
3 changed files with 27 additions and 9 deletions

View File

@ -12,10 +12,10 @@
<br /><br />
+--------------------------------+---------------------------------+
| Events | Date |
+================================+=================================+
+------------------------------------+------------------------------------+-----------+
| Events | Date | Status |
+====================================+====================================+===========+
{% for event in events %}
| {{ "%29s" % event['name'] }} | {{ "%29s" % event['date_str'] }} |
+--------------------------------+---------------------------------+
| {{ "%29s" % event['name_str'] }} | {{ "%29s" % event['date_str'] }} | {{ "%7s" % event['status'] }} |
+------------------------------------+------------------------------------+-----------+
{% endfor %}

View File

@ -15,6 +15,8 @@
import os
import yaml
import calendar
import time
from jinja2 import FileSystemLoader
from jinja2.environment import Environment
@ -26,9 +28,23 @@ def build_timer(app):
app.add_javascript("event_timer.js")
data = yaml.load(open("events.yaml").read())
# add better text for tabulatted planning
now = time.time()
outdated = '*'
for ev in data:
d, h = ev['date'].split('T')
ev['date_str'] = "%s, %s UTC" % (d, h)
epoch_time = calendar.timegm(
time.strptime(ev['date'], "%Y-%m-%dT%H:%M"))
ev['status'] = 'past'
if epoch_time > now:
if outdated == '*':
# Mark upcoming event as bold
ev['status'] = 'current'
outdated = '**'
else:
ev['status'] = 'future'
outdated = ''
ev['date_str'] = "%s%s, %s UTC%s" % (outdated, d, h, outdated)
ev['name_str'] = "%s%s%s" % (outdated, ev['name'], outdated)
output_file = os.path.join(PATH_PREFIX, "events.rst")
with open(output_file, "w") as out:
template_dir = os.path.join(".", "doc", "source", "_exts")

View File

@ -1,6 +1,8 @@
====================
OpenStack Election
====================
==================
OpenStack Election
==================
.. warning:: This is a test for Newton cycle
.. include:: ./candidates/events.rst