add markdown support for talk description

This commit is contained in:
lesion 2017-05-07 02:11:25 +02:00 committed by dbz
parent bb009388ae
commit 27eb51e5a7
2 changed files with 5 additions and 1 deletions

View file

@ -11,6 +11,7 @@ import re
import datetime import datetime
import shutil import shutil
import time import time
import markdown
from docutils import nodes from docutils import nodes
from docutils.parsers.rst import directives, Directive from docutils.parsers.rst import directives, Directive
@ -129,6 +130,9 @@ jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.join(TALKS_PATH, '_templates')), loader=jinja2.FileSystemLoader(os.path.join(TALKS_PATH, '_templates')),
autoescape=True, autoescape=True,
) )
jinja_env.filters['markdown'] = lambda text: \
jinja2.Markup(markdown.Markdown(extensions=['meta']).
convert(text))
class TalkListDirective(Directive): class TalkListDirective(Directive):

View file

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