From 27eb51e5a73b051afc913b47a283f729f23ace05 Mon Sep 17 00:00:00 2001 From: lesion Date: Sun, 7 May 2017 02:11:25 +0200 Subject: [PATCH] add markdown support for talk description --- plugins/talks.py | 4 ++++ talks/_templates/talk.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/talks.py b/plugins/talks.py index 231b8d6..5da0cd3 100644 --- a/plugins/talks.py +++ b/plugins/talks.py @@ -11,6 +11,7 @@ import re import datetime import shutil import time +import markdown from docutils import nodes from docutils.parsers.rst import directives, Directive @@ -129,6 +130,9 @@ jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.join(TALKS_PATH, '_templates')), autoescape=True, ) +jinja_env.filters['markdown'] = lambda text: \ + jinja2.Markup(markdown.Markdown(extensions=['meta']). + convert(text)) class TalkListDirective(Directive): diff --git a/talks/_templates/talk.html b/talks/_templates/talk.html index 55f35a4..560a1f4 100644 --- a/talks/_templates/talk.html +++ b/talks/_templates/talk.html @@ -11,7 +11,7 @@

Stanza {{ room }}

{% endif %} -
{{text}}
+
{{text | markdown}}
{% if links is defined or resources is defined or mail is defined %}

Link utili: