diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-12-28 17:14:28 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-12-28 17:14:28 +0100 |
commit | 3ac28c509c0759a881ebfd06d300507e8db2c9d2 (patch) | |
tree | 1e12c26ddc454f101496c91729b60deeaa5c47a9 /emitter.py | |
parent | 96cf5fdbbfec1902fcaeeb3ba6c75ccf92f1f2f7 (diff) | |
download | ruamel.yaml-3ac28c509c0759a881ebfd06d300507e8db2c9d2.tar.gz |
preserve anchors on scalars, on tagged objects0.15.82
fixes issue #63
fixes issue #266
*When this change indeed resolves your problem, please **Close** this issue*.
*(You can do so using the WorkFlow pull-down (close to the top right of this page))*
Diffstat (limited to 'emitter.py')
-rw-r--r-- | emitter.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -402,8 +402,12 @@ class Emitter(object): if isinstance(self.event, AliasEvent): self.expect_alias() elif isinstance(self.event, (ScalarEvent, CollectionStartEvent)): - if self.process_anchor(u'&') and isinstance(self.event, ScalarEvent): - self.no_newline = True + if ( + self.process_anchor(u'&') + and isinstance(self.event, ScalarEvent) + and self.sequence_context + ): + self.sequence_context = False self.process_tag() if isinstance(self.event, ScalarEvent): # nprint('@', self.indention, self.no_newline, self.column) @@ -848,6 +852,7 @@ class Emitter(object): # if self.analysis.multiline and split \ # and (not self.style or self.style in '\'\"'): # self.write_indent() + # nprint('xx', self.sequence_context, self.flow_level) if self.sequence_context and not self.flow_level: self.write_indent() if self.style == '"': |