mirror of
https://github.com/norohind/SquadsActivityMonitor.git
synced 2025-04-12 13:00:02 +03:00
temlates_engine: support for nested templates including
This commit is contained in:
parent
066d12f778
commit
1ecb7b4b26
@ -15,7 +15,13 @@ def render(template_name: str, context: dict):
|
||||
template_path = join(templates_dir, template_name)
|
||||
template = get_file_content(template_path)
|
||||
|
||||
including = True
|
||||
|
||||
while including:
|
||||
including = False
|
||||
|
||||
for include_statement in re.findall(include_pattern, template):
|
||||
including = True
|
||||
file_include = include_statement.split(' ')[1][1:]
|
||||
include_content = get_file_content(join(templates_dir, file_include))
|
||||
template = template.replace(include_statement, include_content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user