From: Attila-Mihaly Balazs Date: Wed, 15 Jan 2014 18:36:34 +0000 (+0200) Subject: Add replacement for the markdown filter (removed in Django 1.6) X-Git-Tag: live~28^2~2 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/c37aa7a23be8c834cecdff3a2141e0ef91dbaea2?hp=067167bd098e14974dc885a23f04a1feedbf2155 Add replacement for the markdown filter (removed in Django 1.6) --- diff --git a/forum/skins/default/templates/question_edit_tips.html b/forum/skins/default/templates/question_edit_tips.html index ea12bdd..77bfa05 100644 --- a/forum/skins/default/templates/question_edit_tips.html +++ b/forum/skins/default/templates/question_edit_tips.html @@ -1,9 +1,9 @@ -{% load i18n general_sidebar_tags %} +{% load i18n general_sidebar_tags extra_filters %}

{% trans "Title Tips" %}

- {{ settings.QUESTION_TITLE_TIPS|markdown:"settingsparser" }} + {{ settings.QUESTION_TITLE_TIPS|static_content:"markdown" }} @@ -15,10 +15,9 @@

{% trans "What Are Tags" %}

- {{ settings.QUESTION_TAG_TIPS|markdown:"settingsparser" }} + {{ settings.QUESTION_TAG_TIPS|static_content:"markdown" }}
- diff --git a/forum/skins/default/templates/static.html b/forum/skins/default/templates/static.html index 87fe120..26819ff 100644 --- a/forum/skins/default/templates/static.html +++ b/forum/skins/default/templates/static.html @@ -1,11 +1,11 @@ {% extends "base_content.html" %} -{% load i18n %} +{% load i18n extra_filters %} {% block title %}{% spaceless %}{{ title }}{% endspaceless %}{% endblock %} {% block content %}
{{ title }}
-{{ content|markdown:"settingsparser" }} +{{ content|static_content:"markdown" }}
{% endblock %} diff --git a/forum/skins/default/templates/users/info.html b/forum/skins/default/templates/users/info.html index 7937ea0..c7d50e5 100644 --- a/forum/skins/default/templates/users/info.html +++ b/forum/skins/default/templates/users/info.html @@ -122,7 +122,7 @@ {% if not view_user.is_suspended %}
{% if view_user.about %} - {{view_user.about|markdown}} + {{view_user.about|static_content:"markdown-safe"}} {% endif %}
{% endif %} diff --git a/forum/templatetags/extra_filters.py b/forum/templatetags/extra_filters.py index 8dea68c..01e5501 100644 --- a/forum/templatetags/extra_filters.py +++ b/forum/templatetags/extra_filters.py @@ -57,7 +57,9 @@ def contained_in(item, container): def static_content(content, render_mode): if render_mode == 'markdown': return mark_safe(markdown.markdown(unicode(content), ["settingsparser"])) + elif render_mode == 'markdown-safe': + return mark_safe(markdown.markdown(unicode(content), safe_mode=True)) elif render_mode == "html": return mark_safe(unicode(content)) else: - return unicode(content) \ No newline at end of file + return unicode(content)