# flask-mustache Flask plugin

@@ -23,8 +23,971 @@
  plugin%0A
+from flask import current_app%0A%0A# context processor%0Adef mustache_templates():%0A    %22Returns the content of all Mustache templates in the Jinja environment%22%0A    all_templates = current_app.jinja_loader.list_templates('.mustache')%0A    # returns a dictionary of %7Btemplate name:content%7D%0A    mustache_templates = %7B%7D%0A    for template in all_templates:%0A        # TODO: need to remove Jinja load path from path and leave%0A        # trailing path%0A        pass%0A    return %7B'mustache_templates': mustache_templates%7D%0A%0A# template helper function%0Adef mustache(template, **kwargs):%0A    %22%22%22Usage:%0A%0A        %7B%7B mustache('path/to/whatever.mustache', key=value, key1=value1.. keyn=valuen) %7D%7D%0A%0A    This uses the regular Jinja2 loader to find the templates, so your *.mustache files%0A    will need to be available in that path.%0A    %22%22%22%0A    template, _, _ = current_app.jinja_loader.get_source(current_app.jinja_env, template)%0A    return pystache.render(template, kwargs, encoding='utf-8')%0A

Work in progress context processor and template helper