From c37aa7a23be8c834cecdff3a2141e0ef91dbaea2 Mon Sep 17 00:00:00 2001 From: Attila-Mihaly Balazs Date: Wed, 15 Jan 2014 20:36:34 +0200 Subject: [PATCH] Add replacement for the markdown filter (removed in Django 1.6) --- forum/skins/default/templates/question_edit_tips.html | 7 +++---- forum/skins/default/templates/static.html | 4 ++-- forum/skins/default/templates/users/info.html | 2 +- forum/templatetags/extra_filters.py | 4 +++- 4 files changed, 9 insertions(+), 8 deletions(-) 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) -- 2.39.5