1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge remote branch 'stijnopheide/jinja-relative' into devel

Conflicts:
	.gitignore
This commit is contained in:
Michael DeHaan 2012-10-10 20:24:12 -04:00
commit 7e542d78a7
2 changed files with 5 additions and 1 deletions

3
.gitignore vendored
View file

@ -16,3 +16,6 @@ rpm-build
.DS_Store .DS_Store
# manpage build results (not all checked in) # manpage build results (not all checked in)
docs/man/man3/* docs/man/man3/*
# Sublime stuff
*.sublime-project
*.sublime-workspace

View file

@ -392,7 +392,8 @@ def template_from_file(basedir, path, vars):
''' run a file through the templating engine ''' ''' run a file through the templating engine '''
realpath = path_dwim(basedir, path) 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['to_json'] = json.dumps
environment.filters['from_json'] = json.loads environment.filters['from_json'] = json.loads
environment.filters['to_yaml'] = yaml.dump environment.filters['to_yaml'] = yaml.dump