OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 def get_unescaped_template_environment(): | 134 def get_unescaped_template_environment(): |
135 """ | 135 """ |
136 Returns a Jinja2 template environment without autoescaping. Don't use this t
o | 136 Returns a Jinja2 template environment without autoescaping. Don't use this t
o |
137 generate HTML files! | 137 generate HTML files! |
138 """ | 138 """ |
139 from sitescripts.templateFilters import filters | 139 from sitescripts.templateFilters import filters |
140 import jinja2 | 140 import jinja2 |
141 env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath)) | 141 env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath)) |
142 env.filters.update(filters) | 142 env.filters.update(filters) |
143 return env | 143 return env |
| 144 |
| 145 def get_custom_template_environment(additional_filters): |
| 146 """ |
| 147 Returns a custom Jinja2 template environment with additional filters. |
| 148 """ |
| 149 from sitescripts.templateFilters import filters |
| 150 import jinja2 |
| 151 env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath), auto
escape=True, extensions=['jinja2.ext.autoescape']) |
| 152 env.filters.update(filters) |
| 153 env.filters.update(additional_filters) |
| 154 return env |
OLD | NEW |