|
|
@ -65,14 +65,14 @@ def get_text_joined(list_, separator=DEFAULT_SEPARATOR, last_word=ugettext_lazy( |
|
|
|
|
|
|
|
|
|
|
|
def slimdown(text): |
|
|
|
def slimdown(text): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Converts simplified markdown (*, **, _) to <i>, <b> und <u> tags. |
|
|
|
Converts simplified markdown (**, *, _) to <b>, <i> und <u> tags. |
|
|
|
""" |
|
|
|
""" |
|
|
|
i_pattern = re.compile(r"(\*)(.*?)\1") |
|
|
|
|
|
|
|
b_pattern = re.compile(r"(\*\*)(.*?)\1") |
|
|
|
b_pattern = re.compile(r"(\*\*)(.*?)\1") |
|
|
|
|
|
|
|
i_pattern = re.compile(r"(\*)(.*?)\1") |
|
|
|
u_pattern = re.compile(r"(__)(.*?)\1") |
|
|
|
u_pattern = re.compile(r"(__)(.*?)\1") |
|
|
|
|
|
|
|
|
|
|
|
text, n = re.subn(i_pattern, "<i>\\2</i>", text) |
|
|
|
|
|
|
|
text, n = re.subn(b_pattern, "<b>\\2</b>", text) |
|
|
|
text, n = re.subn(b_pattern, "<b>\\2</b>", text) |
|
|
|
|
|
|
|
text, n = re.subn(i_pattern, "<i>\\2</i>", text) |
|
|
|
text, n = re.subn(u_pattern, "<u>\\2</u>", text) |
|
|
|
text, n = re.subn(u_pattern, "<u>\\2</u>", text) |
|
|
|
return mark_safe(text) |
|
|
|
return mark_safe(text) |
|
|
|
|
|
|
|
|
|
|
|