diff options
author | Tina Müller (tinita) <cpan2@tinita.de> | 2020-03-28 18:06:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 18:06:58 +0100 |
commit | fa1293a11f2137709aec313f5789502406e587dd (patch) | |
tree | 575042111910a3be0d4f4ee43f66bba86f914227 /src | |
parent | 9afa10a8b04e8fb2883b11e7f32f2da1e2ced0d2 (diff) | |
download | libyaml-git-fa1293a11f2137709aec313f5789502406e587dd.tar.gz |
Output document end marker after open ended scalars (#162)
Diffstat (limited to 'src')
-rw-r--r-- | src/emitter.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/emitter.c b/src/emitter.c index 21ef1b2..f2b215f 100644 --- a/src/emitter.c +++ b/src/emitter.c @@ -652,6 +652,18 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter, else if (event->type == YAML_STREAM_END_EVENT) { + /** + * This can happen if a block scalar with trailing empty lines + * is at the end of the stream + */ + if (emitter->open_ended) + { + if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0)) + return 0; + emitter->open_ended = 0; + if (!yaml_emitter_write_indent(emitter)) + return 0; + } if (!yaml_emitter_flush(emitter)) return 0; |