Commit 07dcd487 by Chris Jerdonek

Another README tweak.

parent dc9cb18d
...@@ -94,11 +94,14 @@ To customize template loading on a per-view basis, subclass ``TemplateSpec``. ...@@ -94,11 +94,14 @@ To customize template loading on a per-view basis, subclass ``TemplateSpec``.
See the docstrings of the Renderer_ class and TemplateSpec_ class for See the docstrings of the Renderer_ class and TemplateSpec_ class for
more information. more information.
You can also parse a template: :: You can also pre-parse a template: ::
>>> parsed = pystache.parse(u"Hey {{#who}}{{.}}!{{/who}}") >>> parsed = pystache.parse(u"Hey {{#who}}{{.}}!{{/who}}")
>>> print parsed >>> print parsed
[u'Hey ', _SectionNode(key=u'who', index_begin=12, index_end=18, parsed=[_EscapeNode(key=u'.'), u'!'])] [u'Hey ', _SectionNode(key=u'who', index_begin=12, index_end=18, parsed=[_EscapeNode(key=u'.'), u'!'])]
And then::
>>> print renderer.render(parsed, {'who': 'Pops'}) >>> print renderer.render(parsed, {'who': 'Pops'})
Hey Pops! Hey Pops!
>>> print renderer.render(parsed, {'who': 'you'}) >>> print renderer.render(parsed, {'who': 'you'})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment