mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-02 22:39:09 -07:00
YAML callback: do not remove non-ASCII Unicode from multi-line string output (#1522)
* Do not remove non-ASCII Unicode from multi-line string output. * Added basic tests. * Add Unicode test. * Simplify tests, avoid later Jinja features. * Refactor. * Make use diy tests use callback test framework as well. * Remove color codes. * Work around stable-2.9 bug. * Simplify again.
This commit is contained in:
parent
0d1417dcfa
commit
0a7ed3b019
9 changed files with 322 additions and 255 deletions
|
@ -50,7 +50,7 @@ def my_represent_scalar(self, tag, value, style=None):
|
|||
# ...no trailing space
|
||||
value = value.rstrip()
|
||||
# ...and non-printable characters
|
||||
value = ''.join(x for x in value if x in string.printable)
|
||||
value = ''.join(x for x in value if x in string.printable or ord(x) >= 0xA0)
|
||||
# ...tabs prevent blocks from expanding
|
||||
value = value.expandtabs()
|
||||
# ...and odd bits of whitespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue