templates: minor changes

This commit is contained in:
Izalia Mae 2021-07-31 03:43:37 -04:00
parent fd54ff6d78
commit 4ab1d0aa44

View file

@ -18,25 +18,25 @@ except ModuleNotFoundError:
class Template(Environment): class Template(Environment):
def __init__(self, search=[], global_vars={}, context=None, autoescape=True): def __init__(self, search=[], global_vars={}, context=None, autoescape=True):
self.autoescape = autoescape
self.func_context = context
self.search = FileSystemLoader([]) self.search = FileSystemLoader([])
for path in search:
self.add_search_path(Path(path))
super().__init__( super().__init__(
loader=self.search, loader=self.search,
extensions=[HamlishExtension], extensions=[HamlishExtension],
autoescape=self.autoescape,
lstrip_blocks=True, lstrip_blocks=True,
trim_blocks=True trim_blocks=True
) )
self.autoescape = autoescape
self.func_context = context
self.hamlish_file_extensions=('.haml',) self.hamlish_file_extensions=('.haml',)
self.hamlish_enable_div_shortcut=True self.hamlish_enable_div_shortcut=True
self.hamlish_mode = 'indented' self.hamlish_mode = 'indented'
for path in search:
self.add_search_path(Path(path))
self.globals.update({ self.globals.update({
'markup': Markup, 'markup': Markup,
'cleanhtml': lambda text: ''.join(xml.etree.ElementTree.fromstring(text).itertext()), 'cleanhtml': lambda text: ''.join(xml.etree.ElementTree.fromstring(text).itertext()),