diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2008-04-16 19:43:16 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2008-04-16 19:43:16 +0200 |
commit | ba3757ba35d903543cb498aedf2c7fdaf6cba3b5 (patch) | |
tree | a9afe57dae8ae190281fb03cb15e3185418f2e67 /examples | |
parent | 577ad3827132c6829219a4bb11c4a3feef8b439d (diff) | |
download | jinja2-ba3757ba35d903543cb498aedf2c7fdaf6cba3b5.tar.gz |
added new python only debug hack
--HG--
branch : trunk
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cycle.py | 13 | ||||
-rw-r--r-- | examples/translate.py | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/examples/cycle.py b/examples/cycle.py new file mode 100644 index 0000000..73dd632 --- /dev/null +++ b/examples/cycle.py @@ -0,0 +1,13 @@ +from jinja2 import Environment + + +env = Environment(line_statement_prefix="#", variable_start_string="${", variable_end_string="}") + + +print env.from_string("""\ +<ul> +# for item in range(10) + <li class="${loop.cycle('odd', 'even')}">${item}</li> +# endfor +</ul>\ +""").render() diff --git a/examples/translate.py b/examples/translate.py index d5f792f..9043a21 100644 --- a/examples/translate.py +++ b/examples/translate.py @@ -1,6 +1,7 @@ from jinja2 import Environment print Environment().from_string("""\ +{{ foo.bar }} {% trans %}Hello {{ user }}!{% endtrans %} {% trans count=users|count %}{{ count }} user{% pluralize %}{{ count }} users{% endtrans %} """).render(user="someone") |