Edgewall Software

Changes between Version 11 and Version 12 of MarkupTemplates


Ignore:
Timestamp:
Jul 9, 2006, 8:59:13 PM (18 years ago)
Author:
cmlenz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MarkupTemplates

    v11 v12  
    7171In this example, the default namespace is set to the XHTML namespace, and the namespace for Markup directives is bound to the prefix “py”.
    7272
     73All directives can be applied as attributes, and some can also be used as elements. The `if` directives for conditionals, for example, can be used in both ways:
     74
     75{{{
     76<html xmlns="http://www.w3.org/1999/xhtml"
     77      xmlns:py="http://markup.edgewall.org/"
     78      lang="en">
     79  ...
     80  <div py:if="foo">
     81    <p>Bar</p>
     82  </div>
     83  ...
     84</html>
     85}}}
     86
     87This is basically equivalent to the following:
     88
     89{{{
     90<html xmlns="http://www.w3.org/1999/xhtml"
     91      xmlns:py="http://markup.edgewall.org/"
     92      lang="en">
     93  ...
     94  <py:if test="foo">
     95    <div>
     96      <p>Bar</p>
     97    </div>
     98  </py:if>
     99  ...
     100</html>
     101}}}
     102
     103The rationale behind the second form is that directives not always map naturally to elements in the template. In such cases, the [wiki:MarkupTemplates#pystrip py:strip] directive can be used to strip off the unwanted element, or the directive can simply be used as an element.
     104
    73105=== `py:content` ===
    74106