diff options
author | Anthon van der Neut <anthon@mnt.org> | 2021-03-05 10:37:18 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2021-03-05 10:37:18 +0100 |
commit | 59a2fff10a8a1f41eee55a43f48ad20539c69e75 (patch) | |
tree | da0e987303b88219b643423938ded87a258f6869 /emitter.py | |
parent | 3b3bc4e217719b84dd27b04a4a644e5f39a0eb8e (diff) | |
download | ruamel.yaml-59a2fff10a8a1f41eee55a43f48ad20539c69e75.tar.gz |
last release supporting 2.70.16.13
Diffstat (limited to 'emitter.py')
-rw-r--r-- | emitter.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -206,6 +206,8 @@ class Emitter(object): self.scalar_after_indicator = True # write a scalar on the same line as `---` + self.alt_null = 'null' + @property def stream(self): # type: () -> Any @@ -799,6 +801,11 @@ class Emitter(object): if isinstance(self.event, ScalarEvent): if self.style is None: self.style = self.choose_scalar_style() + if self.event.value == '' and self.style == "'" and \ + tag == 'tag:yaml.org,2002:null' and self.alt_null is not None: + self.event.value = self.alt_null + self.analysis = None + self.style = self.choose_scalar_style() if (not self.canonical or tag is None) and ( (self.style == "" and self.event.implicit[0]) or (self.style != "" and self.event.implicit[1]) |