changeset 536:c937dca76e96

span macro: fix bug, minor other changes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 22 Jun 2010 17:14:34 +0200
parents 4599602f00e5
children 61621f711b18
files data/plugin/macro/span.py
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/span.py	Tue Jun 22 17:05:57 2010 +0200
+++ b/data/plugin/macro/span.py	Tue Jun 22 17:14:34 2010 +0200
@@ -27,13 +27,15 @@
     <<span(css_class=red)>>same as above<<span>>
     <<span(id=foobar)>>some text in a span with id foobar<<span>>
     <<span(title="read this!")>>some text with a mouseover title<<span>>
+
+    if SUPPORT_STYLE_ATTR is True, this also works:
     <<span(style="color: red; font: 20pt sans-serif;")>>20pt sans-serif red<<span>>
 
     @copyright: 2010 MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
 
-SUPPORT_STYLE_ATTR = True # True should be safe, False is safer :)
+SUPPORT_STYLE_ATTR = True  # True should be safe, False is safer :)
 
 Dependencies = []
 
@@ -73,7 +75,7 @@
             if len(decl) == 2:
                 prop = decl[0].strip()
                 val = decl[1].strip()
-                result.append((prop, val))
+                decls.append((prop, val))
         return decls
 
     def style_join(decls):
@@ -110,8 +112,10 @@
               ):
     attrs = {}
     for key, value in [
-        ('css_class', css_class), ('id', id),
-        ('lang', lang), ('dir', dir),
+        ('css_class', css_class),
+        ('id', id),
+        ('lang', lang),
+        ('dir', dir),
         ('title', title),
         #('align', align),
         ]:
@@ -122,9 +126,8 @@
         if style:
             attrs['style'] = make_style_safe(style)
 
-    span = macro.formatter.span
     if attrs:
-        return span(True, **attrs)
+        return macro.formatter.span(True, **attrs)
     else:
-        return span(False)
+        return macro.formatter.span(False)