Created
February 22, 2012 16:32
-
-
Save bradwright/1885907 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import current_app | |
import pystache | |
@template_helper | |
def mustache(template, **kwargs): | |
"""Usage: | |
{{ mustache('path/to/whatever.mustache', key=value, key1=value1.. keyn=valuen) }} | |
""" | |
template, _, _ = current_app.jinja_loader.get_source(current_app.jinja_env, template) | |
return pystache.render(template, kwargs, encoding='utf-8') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment