# HG changeset patch # User Tina Müller (tinita) <cpan2@tinita.de> # Date 1585415218 -3600 # Sat Mar 28 18:06:58 2020 +0100 # Node ID 211d5488df72a363f5db292ed458a0707f923a02 # Parent 45ce8ac56f08e3f9252db803accc9c39cf92b7e8 Output document end marker after open ended scalars (#162) diff --git a/src/emitter.c b/src/emitter.c --- a/src/emitter.c +++ b/src/emitter.c @@ -652,6 +652,18 @@ 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;