summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-08-13 12:25:39 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-08-13 12:25:39 +0200
commit56a22f859d4fa1a0be6a6335fb7e9232ea9e9239 (patch)
treef6cf09417fc8b65877d9c3b04325190404d3bce3 /emitter.py
parentd27c1ffe8156ee462cd7f6b0e812c4f84d0b02d6 (diff)
downloadruamel.yaml-56a22f859d4fa1a0be6a6335fb7e9232ea9e9239.tar.gz
fix lists within lists with comments
had to keep emit the comment and mark it for having been emitted, then reset on next run (as with maps)
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/emitter.py b/emitter.py
index 01ff3b8..52a5c82 100644
--- a/emitter.py
+++ b/emitter.py
@@ -1388,14 +1388,15 @@ class Emitter(object):
if comments is None:
return False
try:
+ start_events = (MappingStartEvent, SequenceStartEvent)
for comment in comments:
- if isinstance(event, MappingStartEvent) and \
+ if isinstance(event, start_events) and \
getattr(comment, 'pre_done', None):
continue
if self.column != 0:
self.write_line_break()
self.write_comment(comment)
- if isinstance(event, MappingStartEvent):
+ if isinstance(event, start_events):
comment.pre_done = True
except TypeError:
print('eventtt', type(event), event)