Index: cms/converters.py |
=================================================================== |
--- a/cms/converters.py |
+++ b/cms/converters.py |
@@ -158,17 +158,17 @@ class Converter: |
return '%s="%s"' % (escape(name), escape(value)) |
for tag in self.whitelist: |
saved = saved_attributes.get(tag, []) |
for attrs in saved: |
attrs = map(stringify_attribute, attrs) |
result = re.sub( |
r"%s([^<>]*?)%s" % (re_escape("<%s>" % tag), re_escape("</%s>" % tag)), |
- r'<%s %s>\1</%s>' % (tag, " ".join(attrs), tag), |
+ r'<%s%s>\1</%s>' % (tag, " " + " ".join(attrs) if attrs else "", tag), |
result, 1, flags=re.S |
) |
result = re.sub( |
r"%s([^<>]*?)%s" % (re_escape("<%s>" % tag), re_escape("</%s>" % tag)), |
r"<%s>\1</%s>" % (tag, tag), |
result, flags=re.S |
) |
return result |