mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Properly count newlines appearing at the end of templates after rendering
Fixes #4633
This commit is contained in:
parent
cda3f06117
commit
959a156195
2 changed files with 18 additions and 2 deletions
|
@ -5,3 +5,11 @@ def isprintable(instring):
|
|||
isprintable = set(instring).issubset(printset)
|
||||
return isprintable
|
||||
|
||||
def count_newlines_from_end(str):
|
||||
i = len(str)
|
||||
while i > 0:
|
||||
if str[i-1] != '\n':
|
||||
break
|
||||
i -= 1
|
||||
return len(str) - i
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue