| Index: cms/converters.py |
| =================================================================== |
| --- a/cms/converters.py |
| +++ b/cms/converters.py |
| @@ -11,17 +11,16 @@ |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| import os, imp, re, jinja2, markdown |
| -from ..utils import get_custom_template_environment |
| # Monkey-patch Markdown's isBlockLevel function to ensure that no paragraphs are |
| # inserted into the <head> tag |
| orig_isBlockLevel = markdown.util.isBlockLevel |
| def isBlockLevel(tag): |
| if tag == "head": |
| return True |
| else: |
| @@ -221,17 +220,18 @@ class TemplateConverter(Converter): |
| exec code in module.__dict__ |
| func = os.path.basename(root) |
| if not hasattr(module, func): |
| raise Exception("Expected function %s not found in filter file %s" % (func, filename)) |
| filters[func] = getattr(module, func) |
| filters[func].module_ref = module # Prevent garbage collection |
| - self._env = get_custom_template_environment(filters, self._SourceLoader(self._params["source"])) |
| + self._env = jinja2.Environment(loader=self._SourceLoader(self._params["source"]), autoescape=True) |
| + self._env.filters.update(filters) |
| def get_html(self, source): |
| template = self._env.from_string(source) |
| return template.render(self._params) |
| def translate(self, name, page=None, links=[]): |
| if page == None: |
| localedata = self._params["localedata"] |