diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2008-05-11 19:48:12 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2008-05-11 19:48:12 +0200 |
commit | 27069d73ec6cc9bbf6ce55f6ef48bafa825508d8 (patch) | |
tree | 20364becc181ed1b3b4d00ce745092a167a51fa1 /jinja2-debug.py | |
parent | d1ff858a7afd41a5cc166820f70c96f08b6d2136 (diff) | |
download | jinja2-27069d73ec6cc9bbf6ce55f6ef48bafa825508d8.tar.gz |
fixed a bug in extension handling
--HG--
branch : trunk
Diffstat (limited to 'jinja2-debug.py')
-rwxr-xr-x | jinja2-debug.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/jinja2-debug.py b/jinja2-debug.py new file mode 100755 index 0000000..1e90242 --- /dev/null +++ b/jinja2-debug.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + Jinja2 Debug Interface + ~~~~~~~~~~~~~~~~~~~~~~ + + Helper script for internal Jinja2 debugging. Requires Werkzeug. + + :copyright: Copyright 2008 by Armin Ronacher. + :license: BSD. +""" +import sys +import jinja2 +from werkzeug import script + +env = jinja2.Environment() + +def shell_init_func(): + def _compile(x): + print env.compile(x, raw=True) + result = { + 'e': env, + 'c': _compile, + 't': env.from_string, + 'p': env.parse + } + for key in jinja2.__all__: + result[key] = getattr(jinja2, key) + return result + + +def action_compile(): + print env.compile(sys.stdin.read(), raw=True) + +action_shell = script.make_shell(shell_init_func) + + +if __name__ == '__main__': + script.run() |