changeset 539:ff3037c75bb1

fix undefined attr if SUPPORT_STYLE_ATTR is False
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 24 Jun 2010 12:32:37 +0200
parents 6cb5b60276b1
children c5c5e955f0f1
files data/plugin/macro/span.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/span.py	Tue Jun 22 17:26:21 2010 +0200
+++ b/data/plugin/macro/span.py	Thu Jun 24 12:32:37 2010 +0200
@@ -123,14 +123,16 @@
             attrs[key] = value
 
     if SUPPORT_STYLE_ATTR:
-        style_given = bool(style)
         safe_style = make_style_safe(style)
         if safe_style:
             attrs['style'] = safe_style
+        # note: if some style was given, we create an opening tag,
+        # even if safe_style is empty (because style was all crap).
+        do_open = bool(style) or bool(attrs)
+    else:
+        do_open = bool(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).
+    if do_open:
         return macro.formatter.span(True, **attrs)
     else:
         return macro.formatter.span(False)