Edgewall Software

Changes between Version 13 and Version 14 of MarkupTemplates


Ignore:
Timestamp:
Jul 10, 2006, 12:08:21 AM (18 years ago)
Author:
cmlenz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MarkupTemplates

    v13 v14  
    117117}}}
    118118
     119Given `bar='Bye'` in the context data, this would produce:
     120
    119121{{{
    120122#!xml
     
    123125</ul>
    124126}}}
     127
     128This directive can only be used as an attribute.
    125129
    126130=== `py:replace` ===
     
    135139}}}
    136140
     141Given `bar='Bye'` in the context data, this would produce:
     142
    137143{{{
    138144#!xml
     
    142148}}}
    143149
     150This directive can only be used as an attribute.
     151
    144152=== `py:attrs` ===
    145153
    146 Adds, modifies or removes attributes from the element.
     154This directive adds, modifies or removes attributes from the element.
     155
     156{{{
     157#!xml
     158<ul xmlns:py="http://markup.edgewall.org/">
     159  <li py:attrs="foo">Bar</li>
     160</ul>
     161}}}
     162
     163Given `foo={'class': 'collapse'}` in the template context, this would produce:
     164
     165{{{
     166#!xml
     167<ul>
     168  <li class="collapse">Bar</li>
     169</ul>
     170}}}
     171
     172This directive can only be used as an attribute.
    147173
    148174=== `py:if` ===
     
    154180=== `py:for` ===
    155181
     182The element is repeated for every item in an iterable:
     183
     184{{{
     185#!xml
     186<ul xmlns:py="http://markup.edgewall.org/">
     187  <li py:for="item in items">${item}</li>
     188</ul>
     189}}}
     190
     191Given `items=[1, 2, 3]` in the context data, this would produce:
     192
     193{{{
     194#!xml
     195<ul>
     196  <li>1</li><li>2</li><li>3</li>
     197</ul>
     198}}}
     199
     200This directive can also be used as an element:
     201
     202{{{
     203#!xml
     204<ul xmlns:py="http://markup.edgewall.org/">
     205  <py:for each="item in items">
     206    <li>${item}</li>
     207  </py:for>
     208</ul>
     209}}}
     210
    156211=== `py:def` ===
    157212