@@ -98,7 +98,7 @@ class Engine(Application): | |||||
if page.source_file.is_text: | if page.source_file.is_text: | ||||
logger.info("Rendering [%s]", page) | logger.info("Rendering [%s]", page) | ||||
context.update(page=page) | context.update(page=page) | ||||
text = template.render(page, context) | |||||
text = template.render(page.source_file.read_all(), context) | |||||
target.write(text) | target.write(text) | ||||
else: | else: | ||||
logger.info("Copying binary file [%s]", page) | logger.info("Copying binary file [%s]", page) |
@@ -49,9 +49,9 @@ class Jinja2Template(Template): | |||||
self.env.globals['media_url'] = media_url | self.env.globals['media_url'] = media_url | ||||
self.env.globals['content_url'] = content_url | self.env.globals['content_url'] = content_url | ||||
def render(self, resource, context): | |||||
def render(self, text, context): | |||||
""" | """ | ||||
Renders the given resource using the context | Renders the given resource using the context | ||||
""" | """ | ||||
template = self.env.get_template(resource.relative_path) | |||||
template = self.env.from_string(text) | |||||
return template.render(context) | return template.render(context) |
@@ -19,9 +19,9 @@ class Template(object): | |||||
""" | """ | ||||
abstract | abstract | ||||
def render(self, resource, context): | |||||
def render(self, text, context): | |||||
""" | """ | ||||
Given the resource, and the context, this function | |||||
Given the text, and the context, this function | |||||
must return the rendered string. | must return the rendered string. | ||||
""" | """ | ||||
abstract | abstract |