aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/template/mako.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2014-03-09 03:14:40 +0100
committerLibravatarAgustin Henze <tin@sluc.org.ar>2014-03-09 03:14:40 +0100
commitfa50632a9d87c3989566fed3e49c160a132e0d14 (patch)
tree81f58cc0dcfbb34710856b59c034bc47c53d91dc /nikola/plugins/template/mako.py
parent2828399ba5cbb14502b023d4de1ba02f13dd5055 (diff)
Imported Upstream version 6.4.0upstream/6.4.0
Diffstat (limited to 'nikola/plugins/template/mako.py')
-rw-r--r--nikola/plugins/template/mako.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/nikola/plugins/template/mako.py b/nikola/plugins/template/mako.py
index 45f4335..5a23230 100644
--- a/nikola/plugins/template/mako.py
+++ b/nikola/plugins/template/mako.py
@@ -49,6 +49,7 @@ class MakoTemplates(TemplateSystem):
lookup = None
cache = {}
+ filters = {}
def get_deps(self, filename):
text = util.read_file(filename)
@@ -81,6 +82,11 @@ class MakoTemplates(TemplateSystem):
module_directory=cache_dir,
output_encoding='utf-8')
+ def set_site(self, site):
+ """Sets the site."""
+ self.site = site
+ self.filters.update(self.site.config['TEMPLATE_FILTERS'])
+
def render_template(self, template_name, output_name, context):
"""Render the template into output_name using context."""
context['striphtml'] = striphtml
@@ -95,6 +101,8 @@ class MakoTemplates(TemplateSystem):
def render_template_to_string(self, template, context):
""" Render template to a string using context. """
+ context = context.update(self.filters)
+
return Template(template).render(**context)
def template_deps(self, template_name):