summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-09-26 22:13:40 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-09-26 22:13:40 +0200
commit07e7eb667bbd75b4c127f4f418e8e35c72fb12fe (patch)
treed8cdfa17db0c432a675aa4d3e93be3e86a0712af /emitter.py
parent4f2694580a82e11b5ae13aa3cb1c177af5bb8827 (diff)
downloadruamel.yaml-07e7eb667bbd75b4c127f4f418e8e35c72fb12fe.tar.gz
fix issue #241 incorrect emit of literal scalars with indent indication
test in yaml.data/literal_non_root_indent_indicator.yaml *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.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/emitter.py b/emitter.py
index 3e1a552..e8af852 100644
--- a/emitter.py
+++ b/emitter.py
@@ -1486,9 +1486,10 @@ class Emitter(object):
else:
self.write_line_break(br)
if ch is not None:
- if _indent:
- self.stream.write(u' ' * _indent)
- elif not self.root_context or self.requested_indent:
+ if self.root_context:
+ idnx = self.indent if self.indent is not None else 0
+ self.stream.write(u' ' * (_indent + idnx))
+ else:
self.write_indent()
start = end
else: