Home | Trees | Indices | Help |
|
---|
|
object --+ | Directive --+ | ReplaceDirective
Implementation of the py:replace template directive.
This directive replaces the element with the result of evaluating the value of the py:replace attribute:
>>> from genshi.template import MarkupTemplate >>> tmpl = MarkupTemplate('''<div xmlns:py="http://genshi.edgewall.org/"> ... <span py:replace="bar">Hello</span> ... </div>''') >>> print(tmpl.generate(bar='Bye')) <div> Bye </div>
This directive is equivalent to py:content combined with py:strip, providing a less verbose way to achieve the same effect:
>>> tmpl = MarkupTemplate('''<div xmlns:py="http://genshi.edgewall.org/"> ... <span py:content="bar" py:strip="">Hello</span> ... </div>''') >>> print(tmpl.generate(bar='Bye')) <div> Bye </div>
Nested Classes | |
Inherited from |
Instance Methods | |
Inherited from Inherited from |
Class Methods | |||
|
Class Variables | |
tagname =
|
Properties | |
Inherited from Inherited from |
Method Details |
Called after the template stream has been completely parsed. This class method should return a (directive, stream) tuple. If
directive is not None, it should be an instance of the Directive
class, and gets added to the list of directives applied to the substream
at runtime.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Apr 22 14:10:37 2010 | http://epydoc.sourceforge.net |