span

Description

You can use this macro to open and close (html) spans

For the content contained in the span you can:

Partially supported (only the safe stuff, using a whitelist):

Not supported:

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.

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="&#x27;some classes&#x27;" id="A.27An-id.27" title="&#x27;A Title&#x27;">

-- JimWight 2011-04-19

MoinMoin: MacroMarket/span (last edited 2011-04-19 15:38:11 by ThomasWaldmann)