Esempio n. 1
0
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)
Esempio n. 2
0
 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()