Closed brighid closed 8 years ago
Thanks for this. I wouldn't have noticed the issue with multiple documents.
Sounds like .loadAll might be the way to go.
FIxed. Added a parse-documents method to the reader and also parse-string will return a list of parsed documents if it encounters a string with multiple docs. New version here https://clojars.org/io.forward/yaml. Let me know if you have any issues. Thanks
Awesome; thank you. :)
Because #'from-file uses SnakeYAML's
.load
method, it can only handle input files that contain exactly one YAML document. Files that contain multiple YAML documents are not tremendously common, but are 100% permitted by the spec and definitely exist in the wild — for example, the way that the Jekyll/Octopress CMS stores pages/posts. When #'from-file encounters a multi-document input file, it throws an error like the following.As a point of information, when SnakeYAML's
.loadAll
method is called with multi-document input, it returns a lazy sequence of parsed documents.