[svn] added doc notes to the installation instructions
[jinja2.git] / jdebug.py
1 # -*- coding: utf-8 -*-
2 """
3     jdebug
4     ~~~~~~
5
6     Helper module to simplify jinja debugging. Use
7
8     :copyright: 2006 by Armin Ronacher.
9     :license: BSD, see LICENSE for more details.
10 """
11 from jinja import Environment
12 from jinja.parser import Parser
13 from jinja.lexer import Lexer
14 from jinja.translators.python import PythonTranslator
15
16
17 __all__ = ['e', 't', 'p', 'l']
18
19 e = Environment()
20 t = e.from_string
21
22 def p(x):
23     print PythonTranslator(e, Parser(e, x).parse()).translate()
24
25 def l(x):
26     for item in e.lexer.tokenize(x):
27         print '%5s  %-20s  %r' % item