# HG changeset patch # User Reimar Bauer # Date 1390128020 -3600 # Node ID cb62df6e4e77f360677d6f042c0329914847fcf8 # Parent e4f16be8b5b0b8808709f6ba113766d1342c22be template dates imports content from a rst table diff -r e4f16be8b5b0 -r cb62df6e4e77 pymove3d.py --- a/pymove3d.py Sun Jan 19 10:52:51 2014 +0100 +++ b/pymove3d.py Sun Jan 19 11:40:20 2014 +0100 @@ -14,6 +14,10 @@ from sayings import get_saying from jinja2 import Environment, FileSystemLoader +import codecs +from docutils.core import publish_parts + + LANGUAGE_SELECTED = "de" #ToDo after engelish is implemented set LANGUAGE_SELECTED = None @@ -103,8 +107,15 @@ @app.route("/dates") def dates(): - return render_template(get_locale() + "/dates.html", - act="dates") + content = u"" + filename = os.path.join("templates", get_locale(), "rst", "dates.rst") + if os.path.isfile(filename): + with codecs.open(filename, 'r', 'utf-8') as f: + rst_data = f.read() + f.close() + content = publish_parts(rst_data, writer_name='html')['html_body'] + return render_template("/dates.html", + act="dates", content=content) @app.errorhandler(404) diff -r e4f16be8b5b0 -r cb62df6e4e77 templates/dates.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/dates.html Sun Jan 19 11:40:20 2014 +0100 @@ -0,0 +1,8 @@ +{% extends "theme.html" %} +{% block body %} +
+
+{{ content|safe }} +
+
+{% endblock %} diff -r e4f16be8b5b0 -r cb62df6e4e77 templates/de/dates.html --- a/templates/de/dates.html Sun Jan 19 10:52:51 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -{% extends "theme.html" %} -{% block body %} -
-
-

Termine

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DatumOrtAktivität
13.-14.03.2014Chemnitz (Linuxtag)Kurs/Workshop
29.-30.03.2014KölnBarcamp
01.05.2014-Einsendeschluss
21.07. - 27.07.2014Berlin (EuroPython 2014)Preisverleihung
- - -
-
-{% endblock %} diff -r e4f16be8b5b0 -r cb62df6e4e77 templates/de/rst/dates.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/de/rst/dates.rst Sun Jan 19 11:40:20 2014 +0100 @@ -0,0 +1,16 @@ +Termine +------- + ++------------------------+---------------------------+--------------------+ +| Datum | Ort | Aktivität | ++========================+===========================+====================+ +| 13.-14.03.2014 | Chemnitz (Linuxtag) | Kurs/Workshop | ++------------------------+---------------------------+--------------------+ +| 29.-30.03.2014 | Köln | Barcamp... | ++------------------------+---------------------------+--------------------+ +| 01.05.2014 | | Einsendeschluss | ++------------------------+---------------------------+--------------------+ +| 21.07. - 27.07.2014 | Berlin (EuroPython 2014) | Preisverleihung | ++------------------------+---------------------------+--------------------+ + + diff -r e4f16be8b5b0 -r cb62df6e4e77 templates/en/dates.html --- a/templates/en/dates.html Sun Jan 19 10:52:51 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -{% extends "theme.html" %} -{% block body %} -
-
-

Termine

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DatumOrtAktivität
13.-14.03.2014Chemnitz (Linuxtag)Kurs/Workshop
29.-30.03.2014KölnBarcamp
01.05.2014-Einsendeschluss
21.07. - 27.07.2014Berlin (EuroPython 2014)Preisverleihung
- - -
-
-{% endblock %} diff -r e4f16be8b5b0 -r cb62df6e4e77 templates/en/rst/dates.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/en/rst/dates.rst Sun Jan 19 11:40:20 2014 +0100 @@ -0,0 +1,16 @@ +Dates +------- + ++--------------------------+---------------------------+--------------------+ +| Date | Location | Activity | ++==========================+===========================+====================+ +| 2014-03-13 - 2014-03-14 | Chemnitz (Linuxtag) | Kurs/Workshop | ++--------------------------+---------------------------+--------------------+ +| 2014-03-29 - 2014-03-30 | Cologne | Barcamp... | ++--------------------------+---------------------------+--------------------+ +| 2014-05-0114 | | Deadline | ++--------------------------+---------------------------+--------------------+ +| 2014-07-21 - 2014-07-27 | Berlin (EuroPython 2014) | Price-giving | ++--------------------------+---------------------------+--------------------+ + +