Skip to content

Commit

Permalink
Output document end marker after open ended scalars
Browse files Browse the repository at this point in the history
  • Loading branch information
perlpunk committed Mar 26, 2020
1 parent 9afa10a commit cc0d439
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/emitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit cc0d439

Please sign in to comment.