Edgewall Software

Changes between Version 20 and Version 21 of MarkupTemplates


Ignore:
Timestamp:
Jul 11, 2006, 10:17:26 PM (18 years ago)
Author:
cmlenz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MarkupTemplates

    v20 v21  
    178178=== `py:strip` ===
    179179
     180This directive conditionally strips the top-level element from the output. When the value of the `py:strip` attribute evaluates to `True`, the element
     181is stripped from the output:
     182
     183{{{
     184#!xml
     185<div xmlns:py="http://markup.edgewall.org/">
     186  <div py:strip="True"><b>foo</b></div>
     187</div>
     188}}}
     189
     190This would be rendered as:
     191
     192{{{
     193#!xml
     194<div>
     195  <b>foo</b>
     196</div>
     197}}}
     198
     199As a shorthand, if the value of the `py:strip` attribute is empty, that has the same effect as using a truth value (i.e. the element is stripped).
     200
    180201=== `py:if` ===
    181202
    182203The element is only rendered if the expression evaluates to a truth value.
     204
     205{{{
     206#!xml
     207<div xmlns:py="http://markup.edgewall.org/">
     208  <b py:if="foo">${bar}</b>
     209</div>
     210}}}
     211
     212Given the data `{'foo'=True, 'bar'='Hello'}` in the template context, this would produce:
     213
     214{{{
     215#!xml
     216<div>
     217  <b>Hello</b>
     218</div>
     219}}}
     220
     221This directive can also be used as an element:
     222
     223{{{
     224#!xml
     225<div xmlns:py="http://markup.edgewall.org/">
     226  <py:if test="foo">
     227    <b>${bar}</b>
     228  </py:if>
     229</div>
     230}}}
     231
    183232
    184233=== `py:choose` / `py:when` / `py:otherwise` ===
     
    302351}}}
    303352
     353Inside the body of a `py:match` directive, the `select(path)` function is made available so that parts or all of the original element can be incorporated in the output of the match template. See [wiki:MarkupStream#UsingXPath] for more information about this function.
     354
    304355This directive can also be used as an element:
    305356