Check for multiple documents when dumping JSON

This commit is contained in:
Felix Krause 2016-06-08 20:07:29 +02:00
parent 5f6ed61e30
commit 280f0d6ce2
1 changed files with 3 additions and 0 deletions

View File

@ -580,6 +580,9 @@ proc present*(s: var YamlStream, target: Stream, tagLib: TagLibrary,
indentation -= options.indentationStep indentation -= options.indentationStep
of yamlEndDoc: of yamlEndDoc:
if finished(s): break if finished(s): break
if options.style == psJson:
raise newException(YamlPresenterJsonError,
"Cannot output more than one document in JSON style")
safeWrite("..." & newline) safeWrite("..." & newline)
proc transform*(input: Stream, output: Stream, proc transform*(input: Stream, output: Stream,