mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
@@ -76,7 +76,7 @@ def split_args(args):
|
|||||||
do_decode = True
|
do_decode = True
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
do_decode = False
|
do_decode = False
|
||||||
items = args.strip().split('\n')
|
items = args.split('\n')
|
||||||
|
|
||||||
# iterate over the tokens, and reassemble any that may have been
|
# iterate over the tokens, and reassemble any that may have been
|
||||||
# split on a space inside a jinja2 block.
|
# split on a space inside a jinja2 block.
|
||||||
@@ -138,7 +138,10 @@ def split_args(args):
|
|||||||
spacer = ' '
|
spacer = ' '
|
||||||
params[-1] = "%s%s%s" % (params[-1], spacer, token)
|
params[-1] = "%s%s%s" % (params[-1], spacer, token)
|
||||||
else:
|
else:
|
||||||
params[-1] = "%s\n%s" % (params[-1], token)
|
spacer = ''
|
||||||
|
if not params[-1].endswith('\n') and idx == 0:
|
||||||
|
spacer = '\n'
|
||||||
|
params[-1] = "%s%s%s" % (params[-1], spacer, token)
|
||||||
appended = True
|
appended = True
|
||||||
|
|
||||||
# if the number of paired block tags is not the same, the depth has changed, so we calculate that here
|
# if the number of paired block tags is not the same, the depth has changed, so we calculate that here
|
||||||
@@ -170,7 +173,7 @@ def split_args(args):
|
|||||||
# one item (meaning we split on newlines), add a newline back here
|
# one item (meaning we split on newlines), add a newline back here
|
||||||
# to preserve the original structure
|
# to preserve the original structure
|
||||||
if len(items) > 1 and itemidx != len(items) - 1 and not line_continuation:
|
if len(items) > 1 and itemidx != len(items) - 1 and not line_continuation:
|
||||||
if not params[-1].endswith('\n'):
|
if not params[-1].endswith('\n') or item == '':
|
||||||
params[-1] += '\n'
|
params[-1] += '\n'
|
||||||
|
|
||||||
# always clear the line continuation flag
|
# always clear the line continuation flag
|
||||||
|
|||||||
Reference in New Issue
Block a user