annotate data/plugin/macro/span.py @ 534:7bcfe0b3823a

span macro: reformat docstring
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 22 Jun 2010 16:56:31 +0200
parents 1f9926e7f5b5
children 4599602f00e5
rev   line source
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - span generating macro
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
534
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
5 Supported span attrs:
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
6 class (use css_class param)
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
7 id
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
8 lang
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
9 dir
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
10 title
533
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
11
534
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
12 Partially supported attrs:
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
13 if SUPPORT_STYLE_ATTR is True:
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
14 style - only support safe properties that are on whitelist, others
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
15 could contain javascript and thus, be dangerous (XSS etc.)!
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
16
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
17 if SUPPORT_STYLE_ATTR is False:
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
18 style - macro argument is accepted, but will be silently ignored, it
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
19 won't create style attribute output.
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20
534
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
21 Unsupported attrs:
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
22 event attrs - unsafe, can contain javascript, XSS danger
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
23 align - deprecated by the W3C (use css classes)
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 Usage:
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 <<span(red)>>some text contained in a span with css class red<<span>>
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 <<span(css_class=red)>>same as above<<span>>
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 <<span(id=foobar)>>some text in a span with id foobar<<span>>
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 <<span(title="read this!")>>some text with a mouseover title<<span>>
533
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
30 <<span(style="color: red; font: 20pt sans-serif;")>>20pt sans-serif red<<span>>
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 @copyright: 2010 MoinMoin:ThomasWaldmann
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 @license: GNU GPL, see COPYING for details.
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 """
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35
533
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
36 SUPPORT_STYLE_ATTR = True # True should be safe, False is safer :)
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
37
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 Dependencies = []
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
39
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40 from MoinMoin.wikiutil import required_arg
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41
533
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
42 def make_style_safe(style):
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
43 """ make html 'style' attribute value safe """
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
44 # whitelist of safe style attributes, taken from:
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
45 # http://validator.w3.org/feed/docs/warning/DangerousStyleAttr.html
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
46 whitelist = ("azimuth,background,background-color,border,border-bottom,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
47 "border-bottom-color,border-bottom-style,border-bottom-width,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
48 "border-collapse,border-color,border-left,border-left-color,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
49 "border-left-style,border-left-width,border-right,border-right-color,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
50 "border-right-style,border-right-width,border-spacing,border-style,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
51 "border-top,border-top-color,border-top-style,border-top-width,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
52 "border-width,clear,color,cursor,direction,display,elevation,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
53 "float,font,font-family,font-size,font-style,font-variant,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
54 "font-weight,height,letter-spacing,line-height,margin,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
55 "margin-bottom,margin-left,margin-right,margin-top,overflow,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
56 "padding,padding-bottom,padding-left,padding-right,padding-top,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
57 "pause,pause-after,pause-before,pitch,pitch-range,richness,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
58 "speak,speak-header,speak-numeral,speak-punctuation,speech-rate,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
59 "stress,text-align,text-decoration,text-indent,unicode-bidi,"
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
60 "vertical-align,voice-family,volume,white-space,width").split(',')
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
61
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
62 def style_split(style):
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
63 """
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
64 split style into a list of declarations,
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
65 split the declarations into property, value tuples,
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
66 remove all surrounding whitespace
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
67 """
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
68 decls = [decl.split(u':', 1) for decl in style.split(u';')]
534
7bcfe0b3823a span macro: reformat docstring
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 533
diff changeset
69 # remove spaces from property and value
533
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
70 result = []
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
71 for decl in decls:
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
72 if len(decl) == 2:
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
73 result.append((decl[0].strip(), decl[1].strip()))
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
74 return result
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
75
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
76 def style_join(decls):
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
77 """
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
78 join a list of prop, value tuples into a style declaration
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
79 """
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
80 decls = [u'%s: %s' % (prop, val) for prop, val in decls]
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
81 style = u'; '.join(decls)
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
82 return style
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
83
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
84 def decl_filter(decls):
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
85 """
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
86 filter a list of prop, value tuples, only let whitelisted props through
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
87 """
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
88 return [(prop, val) for prop, val in decls if prop in whitelist]
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
89
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
90 decls = style_split(style)
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
91 decls = decl_filter(decls)
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
92 style = style_join(decls)
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
93 return style
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
94
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
95
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 def macro_span(macro,
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 # first the stuff we can directly give to span formatter:
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98 css_class=u'',
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 id=u'',
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100 lang=u'',
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 dir=u'',
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 title=u'',
532
942f9b55773e span macro: remove support for align attr as it is deprecated
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 531
diff changeset
103 # deprecated by W3C:
942f9b55773e span macro: remove support for align attr as it is deprecated
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 531
diff changeset
104 #align=u'',
533
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
105 style=u'',
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 ):
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 attrs = {}
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108 for key, value in [
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 ('css_class', css_class), ('id', id),
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 ('lang', lang), ('dir', dir),
532
942f9b55773e span macro: remove support for align attr as it is deprecated
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 531
diff changeset
111 ('title', title),
942f9b55773e span macro: remove support for align attr as it is deprecated
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 531
diff changeset
112 #('align', align),
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 ]:
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 if value:
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 attrs[key] = value
533
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
116
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
117 if SUPPORT_STYLE_ATTR:
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
118 if style:
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
119 attrs['style'] = make_style_safe(style)
1f9926e7f5b5 span macro: add (hopefully safe) style support, let through only properties on whitelist
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 532
diff changeset
120
531
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121 span = macro.formatter.span
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122 if attrs:
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
123 return span(True, **attrs)
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
124 else:
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
125 return span(False)
bd8e88710547 span macro - see MoinMoin:MacroMarket/span
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
126