mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #342 from jhoekx/fix-jinja-newline
Preserve trailing newline after templating.
This commit is contained in:
commit
036b779188
1 changed files with 4 additions and 1 deletions
|
@ -241,7 +241,10 @@ def template(text, vars, setup_cache, no_engine=False):
|
|||
return text
|
||||
else:
|
||||
template = jinja2.Template(text)
|
||||
return template.render(vars)
|
||||
res = template.render(vars)
|
||||
if text.endswith('\n') and not res.endswith('\n'):
|
||||
res = res + '\n'
|
||||
return res
|
||||
|
||||
def double_template(text, vars, setup_cache):
|
||||
return template(template(text, vars, setup_cache), vars, setup_cache)
|
||||
|
|
Loading…
Reference in a new issue