comparison 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
comparison
equal deleted inserted replaced
533:1f9926e7f5b5 534:7bcfe0b3823a
1 # -*- coding: iso-8859-1 -*- 1 # -*- coding: iso-8859-1 -*-
2 """ 2 """
3 MoinMoin - span generating macro 3 MoinMoin - span generating macro
4 4
5 Supported attrs: css_class, id, lang, dir, title 5 Supported span attrs:
6 class (use css_class param)
7 id
8 lang
9 dir
10 title
6 11
7 Partially supported attrs: style - only safe stuff on whitelist (with 12 Partially supported attrs:
8 SUPPORT_STYLE_ATTR = True), other stuff 13 if SUPPORT_STYLE_ATTR is True:
9 can contain javascript, XSS danger! 14 style - only support safe properties that are on whitelist, others
10 If you don't need style, consider using 15 could contain javascript and thus, be dangerous (XSS etc.)!
11 SUPPORT_STYLE_ATTR = False for better safety. 16
17 if SUPPORT_STYLE_ATTR is False:
18 style - macro argument is accepted, but will be silently ignored, it
19 won't create style attribute output.
12 20
13 Unsupported attrs: event attrs - unsafe, can contain javascript, XSS danger 21 Unsupported attrs:
14 align - deprecated by the W3C (use css classes) 22 event attrs - unsafe, can contain javascript, XSS danger
23 align - deprecated by the W3C (use css classes)
15 24
16 Usage: 25 Usage:
17 <<span(red)>>some text contained in a span with css class red<<span>> 26 <<span(red)>>some text contained in a span with css class red<<span>>
18 <<span(css_class=red)>>same as above<<span>> 27 <<span(css_class=red)>>same as above<<span>>
19 <<span(id=foobar)>>some text in a span with id foobar<<span>> 28 <<span(id=foobar)>>some text in a span with id foobar<<span>>
55 split style into a list of declarations, 64 split style into a list of declarations,
56 split the declarations into property, value tuples, 65 split the declarations into property, value tuples,
57 remove all surrounding whitespace 66 remove all surrounding whitespace
58 """ 67 """
59 decls = [decl.split(u':', 1) for decl in style.split(u';')] 68 decls = [decl.split(u':', 1) for decl in style.split(u';')]
60 # remove spaces from propery and value 69 # remove spaces from property and value
61 result = [] 70 result = []
62 for decl in decls: 71 for decl in decls:
63 if len(decl) == 2: 72 if len(decl) == 2:
64 result.append((decl[0].strip(), decl[1].strip())) 73 result.append((decl[0].strip(), decl[1].strip()))
65 return result 74 return result