diff options
author | Anthon van der Neut <anthon@mnt.org> | 2019-01-02 20:43:06 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2019-01-02 20:43:06 +0100 |
commit | 2004da336f1736f63062fa70dae374b9ad765917 (patch) | |
tree | 01f967e3bfab14d72db2b40bbfcfca782ac2d953 /emitter.py | |
parent | c59babd740f7d6cfd865626f0a0427de8c320987 (diff) | |
download | ruamel.yaml-2004da336f1736f63062fa70dae374b9ad765917.tar.gz |
fix issue with roundtripping mappings keys that are aliases to scalar strings0.15.83
Diffstat (limited to 'emitter.py')
-rw-r--r-- | emitter.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -669,10 +669,15 @@ class Emitter(object): if not isinstance( self.event, (SequenceStartEvent, MappingStartEvent) ): # sequence keys - if self.event.style == '?': - self.write_indicator(u'?', True, indention=True) + try: + if self.event.style == '?': + self.write_indicator(u'?', True, indention=True) + except AttributeError: # aliases have no style + pass self.states.append(self.expect_block_mapping_simple_value) self.expect_node(mapping=True, simple_key=True) + if isinstance(self.event, AliasEvent): + self.stream.write(u' ') else: self.write_indicator(u'?', True, indention=True) self.states.append(self.expect_block_mapping_value) |