summaryrefslogtreecommitdiff
path: root/representer.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 /representer.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 'representer.py')
-rw-r--r--representer.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/representer.py b/representer.py
index 03dcbf4..7468060 100644
--- a/representer.py
+++ b/representer.py
@@ -844,6 +844,16 @@ class RoundTripRepresenter(SafeRepresenter):
best_style = True
try:
comment = getattr(sequence, comment_attrib)
+ node.comment = comment.comment
+ # reset any comment already printed information
+ if node.comment and node.comment[1]:
+ for ct in node.comment[1]:
+ ct.reset()
+ item_comments = comment.items
+ for v in item_comments.values():
+ if v and v[1]:
+ for ct in v[1]:
+ ct.reset()
item_comments = comment.items
node.comment = comment.comment
try: