From 544b5c27c4963afcf2d30822bd76fc06c0463670 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 | 5 +++++ talks/_templates/talk.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/talks.py b/plugins/talks.py index f1d2bfe..25a44b5 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 @@ -138,6 +139,8 @@ class TalkListDirective(Directive): has_content = True def run(self): + md = markdown.Markdown(extensions=['meta']) + jinja_env.filters['markdown'] = lambda text: jinja2.Markup(md.convert(text)) tmpl = jinja_env.get_template('talk.html') return [ nodes.raw('', tmpl.render(**get_talk_data(n)), @@ -153,6 +156,8 @@ class TalkDirective(Directive): has_content = True def run(self): + md = markdown.Markdown(extensions=['meta']) + jinja_env.filters['markdown'] = lambda text: jinja2.Markup(md.convert(text)) tmpl = jinja_env.get_template('talk.html') data = get_talk_data(self.arguments[0]) if data is None: 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: