diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-06-16 09:38:32 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-06-16 09:38:32 +0200 |
commit | 5e1d9fc21cf360295074f12455095f1e403e82af (patch) | |
tree | 117a6dd23f817f95cdfa8288ae57d77908ed10b8 /serializer.py | |
parent | b3205ef9fce5074754c201a76740802e88bb5dd6 (diff) | |
download | ruamel.yaml-5e1d9fc21cf360295074f12455095f1e403e82af.tar.gz |
fix issue #127: quotes for tagged scalars0.15.9
also fixes spurious newlines when using tagged scalars in block sequences
Diffstat (limited to 'serializer.py')
-rw-r--r-- | serializer.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/serializer.py b/serializer.py index c949c79..46884b5 100644 --- a/serializer.py +++ b/serializer.py @@ -152,13 +152,13 @@ class Serializer(object): # if not equal quoting is necessary for strings detected_tag = self.resolver.resolve(ScalarNode, node.value, (True, False)) default_tag = self.resolver.resolve(ScalarNode, node.value, (False, True)) - implicit = (node.tag == detected_tag), (node.tag == default_tag) + implicit = ((node.tag == detected_tag), (node.tag == default_tag), + node.tag.startswith('tag:yaml.org,2002:')) self.emitter.emit(ScalarEvent(alias, node.tag, implicit, node.value, style=node.style, comment=node.comment)) elif isinstance(node, SequenceNode): implicit = (node.tag == self.resolver.resolve(SequenceNode, node.value, True)) comment = node.comment - # print('comment >>>>>>>>>>>>>.', comment, node.flow_style) end_comment = None seq_comment = None if node.flow_style is True: |