示例#1
0
        variable_start_string="{%#.-.**", variable_end_string="**.-.#%}"
    )

    def jinja_process_variable_start_string(src, filename):
        global jinja_env
        template = jinja_env.get_template(filename)
        return template.render()

    processors['Jinja2-variable_start_string'] = jinja_process_variable_start_string
except ImportError:
    pass

try:
    import tornado.template
    from pypugjs.ext.tornado import patch_tornado
    patch_tornado()

    loader = tornado.template.Loader('cases/')

    def tornado_process(src, filename):
        global loader, tornado
        template = tornado.template.Template(src, name='_.pug', loader=loader)
        generated = template.generate(missing=None)
        if isinstance(generated, six.binary_type):
            generated = generated.decode("utf-8")
        return generated

    processors['Tornado'] = tornado_process
except ImportError:
    pass
示例#2
0
    )

    def jinja_process_variable_start_string(src, filename):
        global jinja_env
        template = jinja_env.get_template(filename)
        return template.render()

    processors['Jinja2-variable_start_string'] = jinja_process_variable_start_string
except ImportError:
    pass

try:
    import tornado.template
    from pypugjs.ext.tornado import patch_tornado

    patch_tornado()

    loader = tornado.template.Loader('cases/')

    def tornado_process(src, filename):
        global loader, tornado
        template = tornado.template.Template(src, name='_.pug', loader=loader)
        generated = template.generate(missing=None)
        if isinstance(generated, six.binary_type):
            generated = generated.decode("utf-8")
        return generated

    processors['Tornado'] = tornado_process
except ImportError:
    pass