Index: sitescripts/utils.py |
=================================================================== |
--- a/sitescripts/utils.py |
+++ b/sitescripts/utils.py |
@@ -136,8 +136,19 @@ def get_unescaped_template_environment() |
Returns a Jinja2 template environment without autoescaping. Don't use this to |
generate HTML files! |
""" |
from sitescripts.templateFilters import filters |
import jinja2 |
env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath)) |
env.filters.update(filters) |
return env |
+ |
+def get_custom_template_environment(additional_filters): |
+ """ |
+ Returns a custom Jinja2 template environment with additional filters. |
+ """ |
+ from sitescripts.templateFilters import filters |
+ import jinja2 |
+ env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath), autoescape=True, extensions=['jinja2.ext.autoescape']) |
Sebastian Noack
2013/08/26 16:05:22
You don't need to add the autoescape extesnion to
|
+ env.filters.update(filters) |
+ env.filters.update(additional_filters) |
+ return env |