| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
Directive --+
|
StripDirective
Implementation of the py:strip template directive.
When the value of the py:strip attribute evaluates to True, the element is stripped from the output
>>> from genshi.template import MarkupTemplate >>> tmpl = MarkupTemplate('''<div xmlns:py="http://genshi.edgewall.org/"> ... <div py:strip="True"><b>foo</b></div> ... </div>''') >>> print(tmpl.generate()) <div> <b>foo</b> </div>
Leaving the attribute value empty is equivalent to a truth value.
This directive is particulary interesting for named template functions or match templates that do not generate a top-level element:
>>> tmpl = MarkupTemplate('''<div xmlns:py="http://genshi.edgewall.org/"> ... <div py:def="echo(what)" py:strip=""> ... <b>${what}</b> ... </div> ... ${echo('foo')} ... </div>''') >>> print(tmpl.generate()) <div> <b>foo</b> </div>
| Nested Classes | |
|
Inherited from |
| Instance Methods | |||
|
|||
|
Inherited from Inherited from |
|||
| Class Methods | |
|
Inherited from |
| Class Variables | |
tagname =
|
|
| Properties | |
|
Inherited from Inherited from |
| Method Details |
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Thu Apr 22 14:10:37 2010 | http://epydoc.sourceforge.net |