span
Description
You can use this macro to open and close (html) spans
For the content contained in the span you can:
apply a css class (css_class param sets class attr)
give it a id (id param/attr)
set its language (lang param/attr)
set its writing direction (dir param/attr)
Partially supported (only the safe stuff, using a whitelist):
giving style (style param/attr) - can be switched off, see the code
Not supported:
- giving the misc. event-related attrs (javascript, XSS danger).
align attr - deprecated by W3C (use css classes)
By definition, a span works only within ONE block, so if you need something for multiple blocks (e.g. multiple paragraphs), you have to open/close it in each block.
For details about the span html element, see the span specification on w3.org.
Download & Release Notes
Macro was implemented and tested on moin 1.9.x.
Current version: http://hg.moinmo.in/moin/extensions/file/tip/data/plugin/macro/span.py
Download: http://hg.moinmo.in/moin/extensions/raw-file/tip/data/plugin/macro/span.py
History: http://hg.moinmo.in/moin/extensions/log/tip/data/plugin/macro/span.py
Examples
Supported: <<span(red)>>some text contained in a span with css class red<<span>> <<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>> <<span(style="color: red; font: 20pt sans-serif;")>>20pt sans-serif red<<span>> Unsupported: <<span(style="dangerous: not;")>>we only support whitelisted props<<span>>
First argument of span macro is css_class, so you can easily give a css class by just specifying its value.
Using span macro without parameters makes it close the span.
More examples: <<span(style="background-color: yellow;")>>background color yellow<<span>> <<span(style="color: red;")>>mix span style with '''strong''' or ''emphasized'' <<span>> <<span(style="font: 30pt sans-serif;")>>font is 30pt sans-serif<<span>> || works also || <<span(red)>>in tables<<span>> ||
More details see the docstring in the code.
Predefined css classes in moin 1.9
From common.css of modernized theme:
.red { background-color: #FFCCCC; } .green { background-color: #CCFFCC; } .blue { background-color: #CCCCFF; } .yellow { background-color: #FFF29F; } .orange { background-color: #FFD59B; } .solid { border: 2px solid #000000; padding: 2px; } .dashed { border: 2px dashed #000000; padding: 2px; } .dotted { border: 2px dotted #000000; padding: 2px; } .left { text-align: left; } .center { text-align: center; } .right { text-align: right; } .justify { text-align: justify; }
The last few classes (left, center, right, justify) are for replacement of the deprecated align attribute.
Copyright
See docstring.
License
See docstring.
Bugs
Unknown.
Discussion
Whether quotes are necessary or not, would you expect single-quoted arguments to work? Not quoting and double-quoted arguments are OK, but, for example,
<<span(id='An-id',title='A Title',css_class='some classes')>
generates
<span class="'some classes'" id="A.27An-id.27" title="'A Title'">
-- JimWight 2011-04-19