mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
made template extensions configurable
This commit is contained in:
parent
71625af8a4
commit
88da1b89cb
3 changed files with 17 additions and 5 deletions
|
|
@ -86,12 +86,19 @@ class Generator(object):
|
|||
templates ready to use with Jinja2.
|
||||
"""
|
||||
if name not in self._templates:
|
||||
try:
|
||||
self._templates[name] = self.env.get_template(name + '.html')
|
||||
except TemplateNotFound:
|
||||
for ext in self.settings['TEMPLATE_EXTENSIONS']:
|
||||
try:
|
||||
self._templates[name] = self.env.get_template(name + ext)
|
||||
break
|
||||
except TemplateNotFound:
|
||||
continue
|
||||
|
||||
if name not in self._templates:
|
||||
raise PelicanTemplateNotFound(
|
||||
'[templates] unable to load {}.html from {}'.format(
|
||||
name, self._templates_path))
|
||||
'[templates] unable to load {}[{}] from {}'.format(
|
||||
name, ', '.join(self.settings['TEMPLATE_EXTENSIONS']),
|
||||
self._templates_path))
|
||||
|
||||
return self._templates[name]
|
||||
|
||||
def _include_path(self, path, extensions=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue