add markdown support for talk description

This commit is contained in:
lesion 2017-05-07 02:11:25 +02:00
parent 167e2aa1fc
commit 544b5c27c4
2 changed files with 6 additions and 1 deletions

View file

@ -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:

View file

@ -11,7 +11,7 @@
<p>Stanza {{ room }}</p>
{% endif %}
</div>
<div class="talk-description">{{text}}</div>
<div class="talk-description">{{text | markdown}}</div>
{% if links is defined or resources is defined or mail is defined %}
<div class="talk-resources">
<h4>Link utili:</h4>