mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
relative paths for (include/extends) in jinja2 templates
This commit is contained in:
@@ -392,7 +392,8 @@ def template_from_file(basedir, path, vars):
|
||||
''' run a file through the templating engine '''
|
||||
|
||||
realpath = path_dwim(basedir, path)
|
||||
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(basedir), trim_blocks=True)
|
||||
loader=jinja2.FileSystemLoader([basedir,os.path.dirname(realpath)])
|
||||
environment = jinja2.Environment(loader=loader, trim_blocks=True)
|
||||
environment.filters['to_json'] = json.dumps
|
||||
environment.filters['from_json'] = json.loads
|
||||
environment.filters['to_yaml'] = yaml.dump
|
||||
|
||||
Reference in New Issue
Block a user