From 56a22f859d4fa1a0be6a6335fb7e9232ea9e9239 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Sun, 13 Aug 2017 12:25:39 +0200 Subject: 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) --- representer.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'representer.py') 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: -- cgit v1.2.1