Open
Description
The parse-yaml
task fails when no YAML frontmatter is provided, but a valid asciidoctor codeblock is encountered further down the file:
Minimal source example:
= Bugreport
[source, json]
----
{"a", "b"}
----
Stacktrace:
org.yaml.snakeyaml.parser.ParserException: null; expected '<document start>', but found BlockSequenceStart; in 'string', line 2, column 1:
-
^
problem: "expected '<document start>', but found BlockSequenceStart"
problemMark: #object[org.yaml.snakeyaml.error.Mark 0x7d787635 " in 'string', line 2, column 1:\n -\n ^"]
org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce ParserImpl.java: 225
org.yaml.snakeyaml.parser.ParserImpl.peekEvent ParserImpl.java: 158
org.yaml.snakeyaml.parser.ParserImpl.checkEvent ParserImpl.java: 143
org.yaml.snakeyaml.composer.Composer.getSingleNode Composer.java: 108
org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData BaseConstructor.java: 120
org.yaml.snakeyaml.Yaml.loadFromReader Yaml.java: 481
org.yaml.snakeyaml.Yaml.load Yaml.java: 400
...
clj-yaml.core/parse-string core.clj: 120
...
io.perun.yaml/parse-yaml yaml.clj: 48
...
clojure.core/apply core.clj: 630
boot.pod/eval-fn-call pod.clj: 328
boot.pod/call-in* pod.clj: 379
...
boot.pod/call-in* pod.clj: 382
io.perun/render-in-pod/iter/fn perun.clj: 175
...
clojure.core/seq core.clj: 137
clojure.core/map/fn core.clj: 2616
...
clojure.core/next core.clj: 64
io.perun/content-task/fn/fn/fn perun.clj: 257
io.perun/content-task/fn/fn perun.clj: 257
io.perun/eval725/fn/fn/fn perun.clj: 519
boot.task.built-in/fn/fn/fn/fn/fn/fn built_in.clj: 348
boot.task.built-in/fn/fn/fn/fn/fn built_in.clj: 348
boot.task.built-in/fn/fn/fn/fn built_in.clj: 345
boot.core/run-tasks core.clj: 938
boot.core/boot/fn core.clj: 948
clojure.core/binding-conveyor-fn/fn core.clj: 1916
...
The current workaround is to provide a YAML frontmatter, if only an empty one:
---
---
= Bugreport
[source, json]
----
{"a", "b"}
----
The YAML parser should be made more strict, like only searching for three dashes (---
) and only considering the beginning of the file.