mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #10580 from ansible/v2-parse_kv-newline
Possible fix for the first newline and triple newline problems
This commit is contained in:
commit
70ff7f1b98
1 changed files with 2 additions and 3 deletions
|
@ -211,7 +211,7 @@ def split_args(args):
|
||||||
params.append(token)
|
params.append(token)
|
||||||
appended = True
|
appended = True
|
||||||
elif print_depth or block_depth or comment_depth or inside_quotes or was_inside_quotes:
|
elif print_depth or block_depth or comment_depth or inside_quotes or was_inside_quotes:
|
||||||
if idx == 0 and not inside_quotes and was_inside_quotes:
|
if idx == 0 and was_inside_quotes:
|
||||||
params[-1] = "%s%s" % (params[-1], token)
|
params[-1] = "%s%s" % (params[-1], token)
|
||||||
elif len(tokens) > 1:
|
elif len(tokens) > 1:
|
||||||
spacer = ''
|
spacer = ''
|
||||||
|
@ -251,8 +251,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'):
|
params[-1] += '\n'
|
||||||
params[-1] += '\n'
|
|
||||||
|
|
||||||
# always clear the line continuation flag
|
# always clear the line continuation flag
|
||||||
line_continuation = False
|
line_continuation = False
|
||||||
|
|
Loading…
Reference in a new issue