Skip to content
Myr

jinja2-debug.py

This file

Path

scripts/jinja2-debug.py

43 lines · 1.1 KiB · Python

Last changed by

Fix doctestsMarkus Unterwaditzerbefore adoption599c136

History of this file

Take it

Fix doctestsMarkus Unterwaditzerbefore adoption599c136

lines 1–43why, 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.89 :copyright: Copyright 2010 by Armin Ronacher.10 :license: BSD.11"""12import sys13import jinja214from werkzeug import script1516env = jinja2.Environment(extensions=['jinja2.ext.i18n', 'jinja2.ext.do',17 'jinja2.ext.loopcontrols',18 'jinja2.ext.with_',19 'jinja2.ext.autoescape'],20 autoescape=True)2122def shell_init_func():23 def _compile(x):24 print(env.compile(x, raw=True))25 result = {26 'e': env,27 'c': _compile,28 't': env.from_string,29 'p': env.parse30 }31 for key in jinja2.__all__:32 result[key] = getattr(jinja2, key)33 return result343536def action_compile():37 print(env.compile(sys.stdin.read(), raw=True))3839action_shell = script.make_shell(shell_init_func)404142if __name__ == '__main__':43 script.run()