json-ld / yaml-ld

CG specification for YAML-LD and UCR
https://json-ld.github.io/yaml-ld/spec
Other
19 stars 8 forks source link

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

Closed anatoly-scherbakov closed 3 months ago

anatoly-scherbakov commented 6 months ago

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.

gkellogg commented 6 months ago

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.

anatoly-scherbakov commented 5 months ago

@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?

gkellogg commented 5 months ago

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.

anatoly-scherbakov commented 5 months ago

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

gkellogg commented 5 months ago

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

VladimirAlexiev commented 3 months ago

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

anatoly-scherbakov commented 3 months ago

@VladimirAlexiev the concern is valid indeed. I tried to describe the treatment of spaces and newlines here: https://github.com/json-ld/yaml-ld/pull/132

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

anatoly-scherbakov commented 3 months ago

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