Browse Source

fix slimdown bold

master
j 8 years ago
parent
commit
165453f070
  1. 6
      shared/utils/text.py

6
shared/utils/text.py

@ -65,14 +65,14 @@ def get_text_joined(list_, separator=DEFAULT_SEPARATOR, last_word=ugettext_lazy(
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")
i_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(i_pattern, "<i>\\2</i>", text)
text, n = re.subn(u_pattern, "<u>\\2</u>", text)
return mark_safe(text)

Loading…
Cancel
Save