summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-08-10 18:48:53 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-08-10 18:48:53 +0200
commitfa7ffb48753378f44563db40534b59d6cce36211 (patch)
tree311ab092d5d5545d3f1af62dff5a8047703a4769 /emitter.py
parent4428f383e3377642857a3e929a7c4ffcbbb6ced3 (diff)
downloadruamel.yaml-fa7ffb48753378f44563db40534b59d6cce36211.tar.gz
fix for block sequences with non-commented elements0.15.26
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/emitter.py b/emitter.py
index c288a51..01ff3b8 100644
--- a/emitter.py
+++ b/emitter.py
@@ -375,6 +375,8 @@ class Emitter(object):
if self.event.comment and self.event.comment[0]:
# eol comment on empty flow sequence
self.write_post_comment(self.event)
+ else:
+ self.write_line_break()
self.state = self.states.pop()
else:
if self.canonical or self.column > self.best_width:
@@ -394,6 +396,8 @@ class Emitter(object):
if self.event.comment and self.event.comment[0]:
# eol comment on flow sequence
self.write_post_comment(self.event)
+ else:
+ self.no_newline = False
self.state = self.states.pop()
else:
self.write_indicator(u',', False)
@@ -496,11 +500,10 @@ class Emitter(object):
else:
if self.event.comment and self.event.comment[1]:
self.write_pre_comment(self.event)
- nonl = self.no_newline
+ nonl = self.no_newline if self.column == 0 else False
self.write_indent()
- self.no_newline = nonl
self.write_indicator((u' ' * self.block_seq_indent) + u'-', True, indention=True)
- if self.block_seq_indent + 2 > self.best_indent:
+ if nonl or self.block_seq_indent + 2 > self.best_indent:
self.no_newline = True
self.states.append(self.expect_block_sequence_item)
self.expect_node(sequence=True)