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"&(?!\S+;)", "&", text) |
+ |
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 |