Escape curly braces to avoid substitution error during formatting

This commit is contained in:
Tim Van Baak 2018-10-14 21:48:06 -07:00
parent 8d0b0c7c79
commit 8abcf059b0
1 changed files with 3 additions and 0 deletions

View File

@ -76,6 +76,9 @@ class LexiconArticle:
# Escape angle brackets # Escape angle brackets
para = re.sub("<", "&lt;", para) para = re.sub("<", "&lt;", para)
para = re.sub(">", "&gt;", para) para = re.sub(">", "&gt;", para)
# Escape curly braces
para = re.sub("{", "&#123;", para)
para = re.sub("}", "&#125;", para)
# Replace bold and italic marks with tags # Replace bold and italic marks with tags
para = re.sub(r"//([^/]+)//", r"<i>\1</i>", para) para = re.sub(r"//([^/]+)//", r"<i>\1</i>", para)
para = re.sub(r"\*\*([^*]+)\*\*", r"<b>\1</b>", para) para = re.sub(r"\*\*([^*]+)\*\*", r"<b>\1</b>", para)