json-ld/yaml-ld

YAML under `<script>` HTML tag unsupported in the spec

anatoly-scherbakov opened this issue · 8 comments

JSON-LD API specification supports parsing of JSON-LD documents included in HTML documents with <script> tag. There is a test manifest which tests precisely that.

The YAML-LD spec does not mention anything about that though it does specify the MIME type which could be used for the <script> tag.

Do you think we should be supporting that feature?

Note that it will likely conflict with #119: we cannot do both.

It's generally true of RDF serializations that they can be used in an HTML script tab with the appropriate media type; this should be true for YAML-LD as well. But, you raise the point of the behavior of the extractAllScripts flag; in JSON-LD it would extract all JSON-LD script tags, in YAML-LD it might do that as well as extract all documents from a YAML stream.

@gkellogg what if a YAML-LD snippet with multiple documents is embedded into an HTML document? Do you think we should be flattening all scripts and all documents inside them?

Yes, I think the flag means that all documents inside of all scripts are extracted. If false, then only the first document, just as with JSON-LD.

Note, we should not be making any changes to the CG version of this spec at this point, as we've agreed to move it to the WG (but still need to actually do that). Work can happen in the WG, but that will involve all editors being a part of the WG. In the mean time, we should leave things in issues.

@gkellogg so I cannot contribute to spec/index.html at this point, right? Should I contribute to the snapshot?

We'll discuss on the next call; best is probably to work off a fork, for now.

Hi @anatoly-scherbakov @gkellogg !
A silly concern: can newlines and spaces in <script> be mangled? That would be detrimental to YAML.

@VladimirAlexiev the concern is valid indeed. I tried to describe the treatment of spaces and newlines here: #132

(We still cannot merge that PR since currently the repo is frozen for merges.)

I think I will close this issue. We've already created a new issue about the spacing characters.