Skip to content

Commit fa1293a

Browse files
authored
Output document end marker after open ended scalars (#162)
1 parent 9afa10a commit fa1293a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/emitter.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,18 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
652652
else if (event->type == YAML_STREAM_END_EVENT)
653653
{
654654

655+
/**
656+
* This can happen if a block scalar with trailing empty lines
657+
* is at the end of the stream
658+
*/
659+
if (emitter->open_ended)
660+
{
661+
if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
662+
return 0;
663+
emitter->open_ended = 0;
664+
if (!yaml_emitter_write_indent(emitter))
665+
return 0;
666+
}
655667
if (!yaml_emitter_flush(emitter))
656668
return 0;
657669

0 commit comments

Comments
 (0)