Index: cms/converters.py |
=================================================================== |
--- a/cms/converters.py |
+++ b/cms/converters.py |
@@ -54,16 +54,20 @@ class AttributeParser(HTMLParser.HTMLPar |
def parse(self, text, pagename): |
self.reset() |
self._string = [] |
self._fixed_strings = [] |
self._inside_fixed = False |
self._attrs = {} |
self._pagename = pagename |
+ # Force-escape ampersands, otherwise the parser will autocomplete bogus |
+ # entities. |
+ text = re.sub(r"&(?!\w+;)", "&", text) |
Sebastian Noack
2015/05/04 20:45:33
What's about hexadecimal escapes (e.g. ©). \w
Wladimir Palant
2015/05/05 14:26:14
Done.
|
+ |
try: |
self.feed(text) |
return "".join(self._string), self._attrs, ["".join(s) for s in self._fixed_strings] |
finally: |
self._string = None |
self._attrs = None |
self._pagename = None |
self._inside_fixed = False |