Edgewall Software

Changes between Version 30 and Version 31 of MarkupTemplates


Ignore:
Timestamp:
Aug 20, 2006, 1:58:36 PM (18 years ago)
Author:
cmlenz
Comment:

Explain loader usage in Python API intro

Legend:

Unmodified
Added
Removed
Modified
  • MarkupTemplates

    v30 v31  
    33The most important feature provided by the Markup package is a template engine.
    44
    5 Templates are XML files of some kind (such as XHTML) that include ''[MarkupTemplates#TemplateDirectives processing directives]'' (elements or attributes identified by a separate namespace) that affect how the template is rendered, and ''[MarkupTemplates#TemplateExpressions template expressions]'' that are dynamically substituted by variable data.
     5Templates are XML files of some kind (such as XHTML) that include ''[MarkupTemplates#Directives processing directives]'' (elements or attributes identified by a separate namespace) that affect how the template is rendered, and ''[MarkupTemplates#Expressions template expressions]'' that are dynamically substituted by variable data.
    66
    77This documentation is a work in progress and as of yet rather incomplete.
     
    3535#!xml
    3636<h1>Hello, world!</h1>
     37}}}
     38
     39However, if you want [MarkupTemplates#Includes includes] to work, you should attain the template instance through a `TemplateLoader`, and load the template from a file:
     40
     41{{{
     42#!python
     43from markup.template import TemplateLoader
     44
     45loader = TemplateLoader([templates_dir])
     46tmpl = loader.load('test.html')
     47stream = tmpl.generate(title='Hello, world!')
     48print stream.render('xhtml')
    3749}}}
    3850
     
    390402{{{
    391403#!xml
    392 <div xmlns:py="http://markup.edgewall.org/">
     404<div>
    393405  <span py:with="y=7; z=x+10">$x $y $z</span>
    394406</div>
     
    408420{{{
    409421#!xml
    410 <div xmlns:py="http://markup.edgewall.org/">
     422<div>
    411423  <py:with vars="y=7; z=x+10">$x $y $z</py:with>
    412424</div>