Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml parsing fails on asciidoc code block #192

Open
nicorikken opened this issue Aug 20, 2017 · 1 comment
Open

Yaml parsing fails on asciidoc code block #192

nicorikken opened this issue Aug 20, 2017 · 1 comment
Labels

Comments

@nicorikken
Copy link
Contributor

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.

nicorikken added a commit to nicorikken/perun that referenced this issue Aug 28, 2017
Fixes the issue as described in hashobject#192
by checking the triple dash to be prefixed by either the start of the document,
or the start of a new line. This does still allow for some content before the
actual yaml.
@nicorikken
Copy link
Contributor Author

I just proposed a fix in a PR.

nicorikken added a commit to nicorikken/perun that referenced this issue Aug 29, 2017
Fixes the issue as described in hashobject#192
by checking the triple dash to be prefixed by either the start of the document,
or the start of a new line. This does still allow for some content before the
actual yaml.
nicorikken added a commit to nicorikken/perun that referenced this issue Sep 1, 2017
Fixes the issue as described in hashobject#192
by checking the triple dash to be prefixed by either the start of the document,
or the start of a new line. This does still allow for some content before the
actual yaml.
@allentiak allentiak added the bug label Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants