Skip to content
Myr

jinja2-debug.py

This file

Path

jinja2-debug.py

40 lines · 930 bytes · Python

Last changed by

The jdebug file should have a 2010 copyright as well.Armin Ronacherbefore adoptionae8a930

History of this file

Take it

The walk stopped after 200 commits: lines older than 9a0078d point at it.

Removed a few stdlib dependencies. This is the first step for IronPython support, the second one being a new lexer.Armin Ronacherbefore adoption9a0078d

lines 1–8why, one step back
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-3"""4 Jinja2 Debug Interface5 ~~~~~~~~~~~~~~~~~~~~~~67 Helper script for internal Jinja2 debugging. Requires Werkzeug.8

The jdebug file should have a 2010 copyright as well.Armin Ronacherbefore adoptionae8a930

line 9why, one step back
9 :copyright: Copyright 2010 by Armin Ronacher.

Removed a few stdlib dependencies. This is the first step for IronPython support, the second one being a new lexer.Armin Ronacherbefore adoption9a0078d

lines 10–40why, one step back
10 :license: BSD.
11"""12import sys13import jinja214from werkzeug import script1516env = jinja2.Environment(extensions=['jinja2.ext.i18n', 'jinja2.ext.do',17 'jinja2.ext.loopcontrols'])1819def shell_init_func():20 def _compile(x):21 print env.compile(x, raw=True)22 result = {23 'e': env,24 'c': _compile,25 't': env.from_string,26 'p': env.parse27 }28 for key in jinja2.__all__:29 result[key] = getattr(jinja2, key)30 return result313233def action_compile():34 print env.compile(sys.stdin.read(), raw=True)3536action_shell = script.make_shell(shell_init_func)373839if __name__ == '__main__':40 script.run()