mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
switched clean_data from hardcoded delimiters to actual currently set jinja2 environment delimiters
This commit is contained in:
parent
467c29e3db
commit
79bf66336b
1 changed files with 4 additions and 4 deletions
|
@ -232,18 +232,18 @@ class Templar:
|
|||
|
||||
elif token[1] == self.variable_end[1]:
|
||||
prev_idx = None
|
||||
if token == '%}' and block_openings:
|
||||
if token == self.block_end and block_openings:
|
||||
prev_idx = block_openings.pop()
|
||||
elif token == '}}' and print_openings:
|
||||
elif token == self.variable_end and print_openings:
|
||||
prev_idx = print_openings.pop()
|
||||
|
||||
if prev_idx is not None:
|
||||
# replace the opening
|
||||
data.seek(prev_idx, os.SEEK_SET)
|
||||
data.write('{#')
|
||||
data.write(self.environment.comment_start_string)
|
||||
# replace the closing
|
||||
data.seek(token_start, os.SEEK_SET)
|
||||
data.write('#}')
|
||||
data.write(self.environment.comment_end_string)
|
||||
|
||||
else:
|
||||
raise AnsibleError("Error while cleaning data for safety: unhandled regex match")
|
||||
|
|
Loading…
Reference in a new issue