Changes between Version 30 and Version 31 of MarkupTemplates
- Timestamp:
- Aug 20, 2006, 1:58:36 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MarkupTemplates
v30 v31 3 3 The most important feature provided by the Markup package is a template engine. 4 4 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.5 Templates 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. 6 6 7 7 This documentation is a work in progress and as of yet rather incomplete. … … 35 35 #!xml 36 36 <h1>Hello, world!</h1> 37 }}} 38 39 However, 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 43 from markup.template import TemplateLoader 44 45 loader = TemplateLoader([templates_dir]) 46 tmpl = loader.load('test.html') 47 stream = tmpl.generate(title='Hello, world!') 48 print stream.render('xhtml') 37 49 }}} 38 50 … … 390 402 {{{ 391 403 #!xml 392 <div xmlns:py="http://markup.edgewall.org/">404 <div> 393 405 <span py:with="y=7; z=x+10">$x $y $z</span> 394 406 </div> … … 408 420 {{{ 409 421 #!xml 410 <div xmlns:py="http://markup.edgewall.org/">422 <div> 411 423 <py:with vars="y=7; z=x+10">$x $y $z</py:with> 412 424 </div>