diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-08-13 12:25:39 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-08-13 12:25:39 +0200 |
commit | 56a22f859d4fa1a0be6a6335fb7e9232ea9e9239 (patch) | |
tree | f6cf09417fc8b65877d9c3b04325190404d3bce3 /emitter.py | |
parent | d27c1ffe8156ee462cd7f6b0e812c4f84d0b02d6 (diff) | |
download | ruamel.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.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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) |