From 95053185a34ebdfd93cf81a49a84c732a2a4782a Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Sat, 3 Feb 2024 21:44:34 +0400 Subject: [PATCH 1/6] #131 Ensure `web` directory exists after the repo is cloned --- .gitignore | 4 +++- web/.gitkeep | 0 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 web/.gitkeep diff --git a/.gitignore b/.gitignore index d664fb2..7616b03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules .idea -/web + +web/ +!web/.gitkeep diff --git a/web/.gitkeep b/web/.gitkeep new file mode 100644 index 0000000..e69de29 From 9fb324c4d67b44be3f1ccbdba24f0f08f230a010 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Sat, 3 Feb 2024 21:50:14 +0400 Subject: [PATCH 2/6] #131 Test ` + + +

Hi!

+ + \ No newline at end of file diff --git a/tests/cases/html-and-yaml-streams/out.yamlld b/tests/cases/html-and-yaml-streams/out.yamlld new file mode 100644 index 0000000..0b3e4ae --- /dev/null +++ b/tests/cases/html-and-yaml-streams/out.yamlld @@ -0,0 +1,12 @@ +- "@id": http://dbpedia.org/resource/John_Lennon + http://schema.org/birthDate: + - "@type": http://www.w3.org/2001/XMLSchema#date + "@value": 1940-10-09 + http://xmlns.com/foaf/0.1/name: + - "@value": John Lennon + http://schema.org/spouse: + - "@id": http://dbpedia.org/resource/Cynthia_Lennon +- "@id": http://dbpedia.org/resource/Cynthia_Lennon + http://schema.org/birthDate: + - "@type": http://www.w3.org/2001/XMLSchema#date + "@value": 1939-09-10 diff --git a/tests/manifest.jsonld b/tests/manifest.jsonld index 1d325b3..345241a 100644 --- a/tests/manifest.jsonld +++ b/tests/manifest.jsonld @@ -188,6 +188,15 @@ "req": "must", "input": "cases/cr-well-formed-3-negative-in.yamlld", "expectErrorCode": "loading document failed" + }, + { + "@id": "#html-and-yaml-streams", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "YAML Stream with multiple documents embedded into HTML.", + "req": "must", + "option": {"extractAllScripts": true}, + "input": "cases/html-and-yaml-streams/in.html", + "expect": "cases/html-and-yaml-streams/out.yamlld" } ] } From 6fabe8daba7fdcc11de196389b8396de8dd53dac Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Sat, 3 Feb 2024 21:50:34 +0400 Subject: [PATCH 3/6] #131 Add `Embedding YAML-LD in HTML Documents` section to the spec --- spec/index.html | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/spec/index.html b/spec/index.html index 66eb918..f43186e 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1007,6 +1007,39 @@

Interoperability Considerations

+
+

Embedding YAML-LD in HTML Documents

+ +

+ YAML-LD content can be easily embedded in HTML [[HTML]] by placing it + in a <script> element with the type attribute set to + `application/ld+yaml`, as illustrated on an example below. +

+ +
+    
+    
+ +

+ If the YAML-LD <script> tag contains a YAML Stream with multiple YAML documents, each of these documents MUST be treated as if it was included in a separate <script> tag. +

+
+

IANA Considerations

From 5c850acd4234467abd6b3d2cd970094219c75469 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Sun, 4 Feb 2024 14:48:01 +0400 Subject: [PATCH 4/6] #131 Specify & test the dedent procedure for YAML-LD blocks --- spec/index.html | 15 +++++++++++++ tests/cases/html/dedent-needed.html | 18 +++++++++++++++ tests/cases/html/dedent-not-needed.html | 18 +++++++++++++++ .../in.html => html/stream.html} | 0 .../out.yamlld => html/stream.yamlld} | 0 tests/manifest.jsonld | 22 +++++++++++++++++-- 6 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 tests/cases/html/dedent-needed.html create mode 100644 tests/cases/html/dedent-not-needed.html rename tests/cases/{html-and-yaml-streams/in.html => html/stream.html} (100%) rename tests/cases/{html-and-yaml-streams/out.yamlld => html/stream.yamlld} (100%) diff --git a/spec/index.html b/spec/index.html index f43186e..7166350 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1035,6 +1035,21 @@

Embedding YAML-LD in HTML Documents

--> +

+ YAML syntax is indentation based. Before processing each `<script>` block with YAML-LD content, YAML-LD processor MUST dedent the body of the block using the following procedure: +

+ +
    +
  • Count the number of leading spaces in the first line of the YAML-LD block, and save that to `dedent_count` variable,
  • +
  • + For each line of the YAML-LD block, +
      +
    • If the number of leading spaces is less than `dedent_count`, keep the line as-is,
    • +
    • Otherwise, remove exactly `dedent_count` leading spaces from the line.
    • +
    +
  • +
+

If the YAML-LD <script> tag contains a YAML Stream with multiple YAML documents, each of these documents MUST be treated as if it was included in a separate <script> tag.

diff --git a/tests/cases/html/dedent-needed.html b/tests/cases/html/dedent-needed.html new file mode 100644 index 0000000..9a2c44d --- /dev/null +++ b/tests/cases/html/dedent-needed.html @@ -0,0 +1,18 @@ + + + + + +

Hi!

+ + \ No newline at end of file diff --git a/tests/cases/html/dedent-not-needed.html b/tests/cases/html/dedent-not-needed.html new file mode 100644 index 0000000..4dc1785 --- /dev/null +++ b/tests/cases/html/dedent-not-needed.html @@ -0,0 +1,18 @@ + + + + + +

Hi!

+ + \ No newline at end of file diff --git a/tests/cases/html-and-yaml-streams/in.html b/tests/cases/html/stream.html similarity index 100% rename from tests/cases/html-and-yaml-streams/in.html rename to tests/cases/html/stream.html diff --git a/tests/cases/html-and-yaml-streams/out.yamlld b/tests/cases/html/stream.yamlld similarity index 100% rename from tests/cases/html-and-yaml-streams/out.yamlld rename to tests/cases/html/stream.yamlld diff --git a/tests/manifest.jsonld b/tests/manifest.jsonld index 345241a..8c7f080 100644 --- a/tests/manifest.jsonld +++ b/tests/manifest.jsonld @@ -195,8 +195,26 @@ "name": "YAML Stream with multiple documents embedded into HTML.", "req": "must", "option": {"extractAllScripts": true}, - "input": "cases/html-and-yaml-streams/in.html", - "expect": "cases/html-and-yaml-streams/out.yamlld" + "input": "cases/html/stream.html", + "expect": "cases/html/stream.yamlld" + }, + { + "@id": "#html-dedent-needed", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "YAML Stream with multiple documents embedded into HTML.", + "req": "must", + "option": {"extractAllScripts": true}, + "input": "cases/html/dedent-needed.html", + "expect": "cases/html/stream.yamlld" + }, + { + "@id": "#html-dedent-not-needed", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "YAML Stream with multiple documents embedded into HTML.", + "req": "must", + "option": {"extractAllScripts": true}, + "input": "cases/html/dedent-not-needed.html", + "expect": "cases/html/stream.yamlld" } ] } From 172c2a63d69606fd6165f67f2d2d4627042b6e67 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Mon, 5 Feb 2024 01:10:25 +0400 Subject: [PATCH 5/6] #131 Ensure that the leading empty lines of the YAML-LD block are skipped when dedenting --- spec/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/index.html b/spec/index.html index 7166350..9389bd7 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1040,7 +1040,7 @@

Embedding YAML-LD in HTML Documents

    -
  • Count the number of leading spaces in the first line of the YAML-LD block, and save that to `dedent_count` variable,
  • +
  • Count the number of leading spaces in the first non-empty line of the YAML-LD block, and save that to `dedent_count` variable,
  • For each line of the YAML-LD block,
      From 10a8502cf13f23180591bf4f9a26062c9a7ce141 Mon Sep 17 00:00:00 2001 From: Ted Thibodeau Jr Date: Wed, 7 Feb 2024 12:08:29 -0500 Subject: [PATCH 6/6] change errant comma to period --- spec/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/index.html b/spec/index.html index 9389bd7..1de9c22 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1040,7 +1040,7 @@

      Embedding YAML-LD in HTML Documents

        -
      • Count the number of leading spaces in the first non-empty line of the YAML-LD block, and save that to `dedent_count` variable,
      • +
      • Count the number of leading spaces in the first non-empty line of the YAML-LD block, and save that to `dedent_count` variable.
      • For each line of the YAML-LD block,