Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/converters.py

Issue 29376953: No issue - Fixed no ESCAPED_CHARS error caused by upstream change in CMS (Closed) Base URL: https://hg.adblockplus.org/cms
Patch Set: Created Feb. 23, 2017, 4:02 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
===================================================================
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -312,22 +312,22 @@
def remove_unnecessary_entities(match):
char = unichr(int(match.group(1)))
if char in html_escapes:
return match.group(0)
else:
return char
escapes = {}
- for char in markdown.Markdown.ESCAPED_CHARS:
+ md = markdown.Markdown(output='html5', extensions=['extra'])
+ for char in md.ESCAPED_CHARS:
escapes[char] = '&#' + str(ord(char)) + ';'
for key, value in html_escapes.iteritems():
escapes[key] = value
- md = markdown.Markdown(output='html5', extensions=['extra'])
md.preprocessors['html_block'].markdown_in_raw = True
def to_html(s):
return re.sub(r'</?p>', '', md.convert(s))
result = self.insert_localized_strings(source, escapes, to_html)
result = md.convert(result)
result = re.sub(r'&#(\d+);', remove_unnecessary_entities, result)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld