def render_str(src, **kw): from jinja2.environment import Environment env = Environment() parsed = Parser(env, src) gen = JsGenerator(env, '<internal>', '<internal>') gen.visit(parsed.parse()) return render(source=gen.stream.getvalue(), **kw)
def js_compile(self, source, name): code = Parser(self.env, source) gen = JsGenerator(self.env, name, name) gen.visit(code.parse()) return gen.stream.getvalue()