mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Allow for no prefix in the comment filter (#17421)
In the 'comment' filter, if the 'prefix' parameter is set as empty, don't add an empty line before the comment. To get the previous behaviour (empty line before comment), set the prefix to '\n'.
This commit is contained in:
committed by
Brian Coca
parent
23f78efd74
commit
f5a4677680
@@ -336,8 +336,14 @@ def comment(text, style='plain', **kw):
|
||||
str_beginning = ''
|
||||
if p['beginning']:
|
||||
str_beginning = "%s%s" % (p['beginning'], p['newline'])
|
||||
str_prefix = str(
|
||||
"%s%s" % (p['prefix'], p['newline'])) * int(p['prefix_count'])
|
||||
str_prefix = ''
|
||||
if p['prefix']:
|
||||
if p['prefix'] != p['newline']:
|
||||
str_prefix = str(
|
||||
"%s%s" % (p['prefix'], p['newline'])) * int(p['prefix_count'])
|
||||
else:
|
||||
str_prefix = str(
|
||||
"%s" % (p['newline'])) * int(p['prefix_count'])
|
||||
str_text = ("%s%s" % (
|
||||
p['decoration'],
|
||||
# Prepend each line of the text with the decorator
|
||||
|
||||
Reference in New Issue
Block a user