Code

Ticket #6526: 6526-mardown-with-options-for-safe-mode.diff

File 6526-mardown-with-options-for-safe-mode.diff, 947 bytes (added by Timothée Peignier <tim@…>, 6 years ago)

Markdown filter accepting options for safe_mode

Line 
1Index: django/contrib/markup/templatetags/markup.py
2===================================================================
3--- django/contrib/markup/templatetags/markup.py        (revision 8061)
4+++ django/contrib/markup/templatetags/markup.py        (working copy)
5@@ -60,9 +60,13 @@
6         # to fully support extensions before 1.6b was the shortlived 1.6a.
7         if hasattr(markdown, 'version'):
8             extensions = [e for e in arg.split(",") if e]
9-            if len(extensions) > 0 and extensions[0] == "safe":
10+            if len(extensions) > 0 and extensions[0] in ('safe','replace','remove','escape'):
11+                # using True for compatibility reason
12+                if extensions[0] = 'safe':
13+                    safe_mode = True
14+                else:
15+                    safe_mode = extensions[0]
16                 extensions = extensions[1:]
17-                safe_mode = True
18             else:
19                 safe_mode = False
20