From 5e1d9fc21cf360295074f12455095f1e403e82af Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Fri, 16 Jun 2017 09:38:32 +0200 Subject: fix issue #127: quotes for tagged scalars also fixes spurious newlines when using tagged scalars in block sequences --- emitter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'emitter.py') 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 -- cgit v1.2.1