changeset 538:6cb5b60276b1

span macro: handle special case if style given is all unsafe crap
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 22 Jun 2010 17:26:21 +0200
parents 61621f711b18
children ff3037c75bb1
files data/plugin/macro/span.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/span.py	Tue Jun 22 17:18:59 2010 +0200
+++ b/data/plugin/macro/span.py	Tue Jun 22 17:26:21 2010 +0200
@@ -123,11 +123,14 @@
             attrs[key] = value
 
     if SUPPORT_STYLE_ATTR:
-        style = make_style_safe(style)
-        if style:
-            attrs['style'] = style
+        style_given = bool(style)
+        safe_style = make_style_safe(style)
+        if safe_style:
+            attrs['style'] = safe_style
 
-    if attrs:
+    if attrs or style_given:
+        # note: if some style was given, we create an opening tag,
+        # even if safe_style was empty (because style was all crap).
         return macro.formatter.span(True, **attrs)
     else:
         return macro.formatter.span(False)