summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-06-16 09:38:32 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-06-16 09:38:32 +0200
commit5e1d9fc21cf360295074f12455095f1e403e82af (patch)
tree117a6dd23f817f95cdfa8288ae57d77908ed10b8 /emitter.py
parentb3205ef9fce5074754c201a76740802e88bb5dd6 (diff)
downloadruamel.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 'emitter.py')
-rw-r--r--emitter.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/emitter.py b/emitter.py
index f2a4ad3..19ff636 100644
--- a/emitter.py
+++ b/emitter.py
@@ -629,6 +629,9 @@ class Emitter(object):
self.prepared_tag = self.prepare_tag(tag)
if self.prepared_tag:
self.write_indicator(self.prepared_tag, True)
+ if self.sequence_context and not self.flow_level and \
+ isinstance(self.event, ScalarEvent):
+ self.no_newline = True
self.prepared_tag = None
def choose_scalar_style(self):
@@ -638,7 +641,7 @@ class Emitter(object):
if self.event.style == '"' or self.canonical:
return '"'
if (not self.event.style or self.event.style == '?') and \
- self.event.implicit[0]:
+ (self.event.implicit[0] or not self.event.implicit[2]):
if (not (self.simple_key_context and
(self.analysis.empty or self.analysis.multiline)) and
(self.flow_level and self.analysis.allow_flow_plain or