diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2008-05-10 22:21:30 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2008-05-10 22:21:30 +0200 |
commit | 09c002e6faaae853563bc1641cb829d91d17a700 (patch) | |
tree | 3393326eef1536e3a5bc4c2ef1c03f5875d266ea /examples | |
parent | fb2e38a806a3e076a8712bd69de1004f0b51e2bb (diff) | |
download | jinja2-09c002e6faaae853563bc1641cb829d91d17a700.tar.gz |
added a function to parse assign targes and documented it for the extension interface
--HG--
branch : trunk
Diffstat (limited to 'examples')
-rw-r--r-- | examples/profile.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/examples/profile.py b/examples/profile.py index 843efb1..a154404 100644 --- a/examples/profile.py +++ b/examples/profile.py @@ -10,11 +10,7 @@ context = { 'table': [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10) for x in range(1000)] } -jinja_template = JinjaEnvironment( - line_statement_prefix='%', - variable_start_string="${", - variable_end_string="}" -).from_string("""\ +source = """\ <!doctype html> <html> <head> @@ -24,15 +20,6 @@ jinja_template = JinjaEnvironment( <div class="header"> <h1>${page_title|e}</h1> </div> - <ul class="navigation"> - % for href, caption in [ - ('index.html', 'Index'), - ('downloads.html', 'Downloads'), - ('products.html', 'Products') - ] - <li><a href="${href|e}">${caption|e}</a></li> - % endfor - </ul> <div class="table"> <table> % for row in table @@ -46,7 +33,13 @@ jinja_template = JinjaEnvironment( </div> </body> </html>\ -""") +""" +jinja_template = JinjaEnvironment( + line_statement_prefix='%', + variable_start_string="${", + variable_end_string="}" +).from_string(source) +print jinja_template.environment.compile(source, raw=True) p = Profile() |