Package genshi :: Package template :: Module markup :: Class MarkupTemplate

Class MarkupTemplate

   object --+    
            |    
base.Template --+
                |
               MarkupTemplate

Implementation of the template language for XML-based templates.

>>> tmpl = MarkupTemplate('''<ul xmlns:py="http://genshi.edgewall.org/">
...   <li py:for="item in items">${item}</li>
... </ul>''')
>>> print tmpl.generate(items=[1, 2, 3])
<ul>
  <li>1</li><li>2</li><li>3</li>
</ul>
Nested Classes

Inherited from base.Template: __metaclass__

Instance Methods

Inherited from base.Template: __getstate__, __init__, __repr__, __setstate__, generate

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables
  DIRECTIVE_NAMESPACE = <Namespace "http://genshi.edgewall.org/">
  XINCLUDE_NAMESPACE = <Namespace "http://www.w3.org/2001/XInclu...
  directives = [('def', <class 'genshi.template.directives.DefDi...
  serializer = 'xml'

Inherited from base.Template: EXEC, EXPR, INCLUDE, SUB

Properties

Inherited from object: __class__

Class Variable Details

XINCLUDE_NAMESPACE

Value:
<Namespace "http://www.w3.org/2001/XInclude">

directives

Value:
[('def', <class 'genshi.template.directives.DefDirective'>),
 ('match', <class 'genshi.template.directives.MatchDirective'>),
 ('when', <class 'genshi.template.directives.WhenDirective'>),
 ('otherwise',
  <class 'genshi.template.directives.OtherwiseDirective'>),
 ('for', <class 'genshi.template.directives.ForDirective'>),
 ('if', <class 'genshi.template.directives.IfDirective'>),
 ('choose', <class 'genshi.template.directives.ChooseDirective'>),
...