summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-03-05 10:37:18 +0100
committerAnthon van der Neut <anthon@mnt.org>2021-03-05 10:37:18 +0100
commit59a2fff10a8a1f41eee55a43f48ad20539c69e75 (patch)
treeda0e987303b88219b643423938ded87a258f6869 /emitter.py
parent3b3bc4e217719b84dd27b04a4a644e5f39a0eb8e (diff)
downloadruamel.yaml-59a2fff10a8a1f41eee55a43f48ad20539c69e75.tar.gz
last release supporting 2.70.16.13
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/emitter.py b/emitter.py
index 99e8abe..f8c5e16 100644
--- a/emitter.py
+++ b/emitter.py
@@ -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])