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

Unified Diff: cms/converters.py

Issue 6556935134380032: Issue 2344 - Fix <em> in translatable strings is being turned into <em > (Closed)
Patch Set: Created April 18, 2015, 7:11 a.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
@@ -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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld