Skip to content

Commit 18bc029

Browse files
committed
* Use respec-w3c instead of respec-w3c-comman.
* Update ReSpec configuration to use group: "wg/json-ld" instead of separate wg* attributes. * Update playground links to not be flagged by ReSpec. * Other changes to common files.
1 parent bd409b8 commit 18bc029

File tree

5 files changed

+41
-165
lines changed

5 files changed

+41
-165
lines changed

common/algorithm-terms.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
which is used for finding coercion mappings in the <a>active context</a>.</dd>
1010
<dt><dfn data-cite="JSON-LD11-API#dfn-active-subject">active subject</dfn></dt><dd>
1111
The currently active subject that the processor should use when processing.</dd>
12-
<dt class="changed"><dfn data-cite="JSON-LD11-API#add-value">add value</dfn></dt>
12+
<dt class="changed"><dfn data-cite="JSON-LD11-API#dfn-add-value">add value</dfn></dt>
1313
<dd class="algorithm changed">
1414
Used as a macro within various algorithms as a way to add a <var>value</var>
1515
to an <a>entry</a> in a <a>map</a> (<var>object</var>) using a specified <var>key</var>.
@@ -38,7 +38,7 @@
3838
</li>
3939
</ol>
4040
</dd>
41-
<dt><dfn data-cite="JSON-LD11-FRAMING#dfn-expicit-inclusion-flag">explicit inclusion flag</dfn></dt><dd>
41+
<dt><dfn data-cite="JSON-LD11-FRAMING#dfn-explicit-inclusion-flag">explicit inclusion flag</dfn></dt><dd>
4242
A flag specifying that for <a>properties</a> to be included in the output,
4343
they must be explicitly declared in the matching <a>frame</a>.</dd>
4444
<dt><dfn data-cite="JSON-LD11-FRAMING#dfn-framing-state">framing state</dfn></dt><dd>
@@ -78,7 +78,7 @@
7878
the <var>document relative</var> flag defaults to `false`,
7979
and the <var>vocab</var> flag defaults to `true`.
8080
<ol>
81-
<li>Return the result of using the <a href="#iri-expansion">IRI Expansion algorithm</a>,
81+
<li>Return the result of using the <a data-cite="JSON-LD11-API#iri-expansion">IRI Expansion algorithm</a>,
8282
passing <var>active context</var>,
8383
<var>value</var>,
8484
<var>local context</var> (if supplied),

common/common.js

Lines changed: 13 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,32 @@
1-
/* globals omitTerms, respecConfig, $, require */
1+
/* globals require */
22
/* JSON-LD Working Group common spec JavaScript */
3-
// We should be able to remove terms that are not actually
4-
// referenced from the common definitions
5-
//
6-
// Add class "preserve" to a definition to ensure it is not removed.
7-
//
8-
// the termlist is in a block of class "termlist".
9-
const termNames = [] ;
10-
const termsReferencedByTerms = [] ;
11-
12-
function restrictReferences(utils, content) {
13-
const base = document.createElement("div");
14-
base.innerHTML = content;
15-
16-
// New new logic:
17-
//
18-
// 1. build a list of all term-internal references
19-
// 2. When ready to process, for each reference INTO the terms,
20-
// remove any terms they reference from the termNames array too.
21-
const noPreserve = base.querySelectorAll("dfn:not(.preserve)");
22-
for (const item of noPreserve) {
23-
const $t = $(item);
24-
const titles = $t.getDfnTitles();
25-
const n = $t.makeID("dfn", titles[0]);
26-
if (n) {
27-
termNames[n] = $t.parent();
28-
}
29-
}
30-
31-
const $container = $(".termlist", base) ;
32-
const containerID = $container.makeID("", "terms") ;
33-
return (base.innerHTML);
34-
}
353

4+
/*
5+
* Implement tabbed examples.
6+
*/
367
require(["core/pubsubhub"], (respecEvents) => {
378
"use strict";
389

39-
respecEvents.sub('end', (message) => {
10+
respecEvents.sub('end-all', (documentElement) => {
4011
// remove data-cite on where the citation is to ourselves.
41-
const selfDfns = document.querySelectorAll("dfn[data-cite^='" + respecConfig.shortName.toUpperCase() + "#']");
12+
const selfDfns = document.querySelectorAll("dfn[data-cite^='__SPEC__#']");
4213
for (const dfn of selfDfns) {
14+
const anchor = dfn.querySelector('a');
15+
if (anchor) {
16+
const anchorContent = anchor.textContent;
17+
dfn.removeChild(anchor);
18+
dfn.textContent = anchorContent;
19+
}
4320
delete dfn.dataset.cite;
4421
}
4522

4623
// Update data-cite references to ourselves.
47-
const selfRefs = document.querySelectorAll("a[data-cite^='" + respecConfig.shortName.toUpperCase() + "#']");
24+
const selfRefs = document.querySelectorAll("a[data-cite^='__SPEC__#']");
4825
for (const anchor of selfRefs) {
4926
anchor.href= anchor.dataset.cite.replace(/^.*#/,"#");
5027
delete anchor.dataset.cite;
5128
}
52-
});
5329

54-
// add a handler to come in after all the definitions are resolved
55-
//
56-
// New logic: If the reference is within a 'dl' element of
57-
// class 'termlist', and if the target of that reference is
58-
// also within a 'dl' element of class 'termlist', then
59-
// consider it an internal reference and ignore it.
60-
respecEvents.sub('end', (message) => {
61-
if (message === 'core/link-to-dfn') {
62-
// all definitions are linked; find any internal references
63-
const internalTerms = document.querySelectorAll(".termlist a.internalDFN");
64-
for (const item of internalTerms) {
65-
const idref = item.getAttribute('href').replace(/^#/,"") ;
66-
if (termNames[idref]) {
67-
// this is a reference to another term
68-
// what is the idref of THIS term?
69-
const def = item.closest('dd');
70-
if (def) {
71-
const tid = def.previousElementSibling
72-
.querySelector('dfn')
73-
.getAttribute('id');
74-
if (tid) {
75-
if (termsReferencedByTerms[tid] === undefined) termsReferencedByTerms[tid] = [];
76-
termsReferencedByTerms[tid].push(idref);
77-
}
78-
}
79-
}
80-
}
81-
82-
// clearRefs is recursive. Walk down the tree of
83-
// references to ensure that all references are resolved.
84-
const clearRefs = (theTerm) => {
85-
if (termsReferencedByTerms[theTerm] ) {
86-
for (const item of termsReferencedByTerms[theTerm]) {
87-
if (termNames[item]) {
88-
delete termNames[item];
89-
clearRefs(item);
90-
}
91-
}
92-
};
93-
// make sure this term doesn't get removed
94-
if (termNames[theTerm]) {
95-
delete termNames[theTerm];
96-
}
97-
};
98-
99-
// now termsReferencedByTerms has ALL terms that
100-
// reference other terms, and a list of the
101-
// terms that they reference
102-
const internalRefs = document.querySelectorAll("a[data-link-type='dfn']");
103-
for (const item of internalRefs) {
104-
const idref = item.getAttribute('href').replace(/^.*#/,"") ;
105-
// if the item is outside the term list
106-
if (!item.closest('dl.termlist')) {
107-
clearRefs(idref);
108-
}
109-
}
110-
111-
// delete any terms that were not referenced.
112-
for (const term in termNames) {
113-
const $p = $("#"+term);
114-
// Remove term definitions inside a dt, where data-cite does not start with shortname
115-
if ($p === undefined) { continue; }
116-
if (!$p.parent().is("dt")) { continue; }
117-
if (($p.data("cite") || "").toLowerCase().startsWith(respecConfig.shortName)) { continue; }
118-
119-
const $dt = $p.parent();
120-
const $dd = $dt.next();
121-
122-
// If the associated dd contains a dfn which is _not_ in termNames, warn
123-
if ($dd.children("dfn").length > 0) {
124-
console.log(term + " definition contains definitions " + $dd.children("dfn").attr("id"))
125-
}
126-
console.log("drop term " + term);
127-
const tList = $p.getDfnTitles();
128-
$dd.remove(); // remove dd
129-
$dt.remove(); // remove dt
130-
// FIXME: this depended on an undocumented internal structure
131-
//for (const item of tList) {
132-
// if (respecConfig.definitionMap[item]) {
133-
// delete respecConfig.definitionMap[item];
134-
// }
135-
//}
136-
}
137-
}
138-
});
139-
});
140-
141-
/*
142-
* Implement tabbed examples.
143-
*/
144-
require(["core/pubsubhub"], (respecEvents) => {
145-
"use strict";
146-
respecEvents.sub('end-all', (documentElement) => {
14730
// Add playground links
14831
for (const link of document.querySelectorAll("a.playground")) {
14932
let pre;

common/terms.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
An embedded <a>context</a> is a context which appears
189189
as the <code>@context</code> <a>entry</a> of one of the following:
190190
a <a>node object</a>, a <a>value object</a>, a <a>graph object</a>, a <a>list object</a>,
191-
a <a>set object</a>, the value of a <a>nested properties</a>,
191+
a <a>set object</a>, the value of a <a>nested property</a>,
192192
or the value of an <a>expanded term definition</a>.
193193
Its value may be a <a>map</a> for a <a data-cite="JSON-LD11#dfn-context-definition">context definition</a>,
194194
as an <a>IRI</a>, or as an <a>array</a> combining either of the above.
@@ -230,7 +230,7 @@
230230
Note that <a>node objects</a> may have a <code>@graph</code> <a>entry</a>,
231231
but are not considered <a>graph objects</a> if they include any other <a>entries</a>.
232232
A top-level object consisting of <code>@graph</code> is also not a <a>graph object</a>.
233-
Note that a <a>node object</a> may also represent a <a>named graph</a> it it includes other properties.
233+
Note that a <a>node object</a> may also represent a <a>named graph</a> if it includes other properties.
234234
See the <a data-cite="JSON-LD11#graph-objects">Graph Objects</a> section of JSON-LD 1.1 for a normative description.
235235
</dd>
236236
<dt class="changed"><dfn data-cite="JSON-LD11#dfn-id-map">id map</dfn></dt><dd class="changed">
@@ -302,7 +302,7 @@
302302
and normatively specified in the <a data-cite="JSON-LD11#keywords">Keywords</a> section of JSON-LD 1.1,
303303
</dd>
304304
<dt><dfn data-cite="JSON-LD11#dfn-language-map">language map</dfn></dt><dd>
305-
An <a>language map</a> is a <a>map</a> value of a <a>term</a>
305+
A <a>language map</a> is a <a>map</a> value of a <a>term</a>
306306
defined with <code>@container</code> set to <code>@language</code>,
307307
whose keys must be <a>strings</a> representing [[BCP47]] language codes
308308
and the values must be any of the following types:

common/typographical-conventions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
A reference to a definition <em>in this document</em>
1616
is underlined and is also an active link to the definition itself. </dd>
1717
<dt><a data-lt="definition"><code>markup definition reference</code></a></dt><dd>
18-
A references to a definition <em>in this document</em>,
18+
References to a definition <em>in this document</em>,
1919
when the reference itself is also a markup, is underlined,
2020
red-orange monospace font, and is also an active link to the definition itself.</dd>
2121
<dt><a class="externalDFN">external definition reference</a></dt><dd>

index.html

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<title>JSON-LD 1.1 Processing Algorithms and API</title>
55
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
6-
<script type="text/javascript" src="https://www.w3.org/Tools/respec/respec-w3c-common" class="remove"></script>
6+
<script type="text/javascript" src="https://www.w3.org/Tools/respec/respec-w3c" class="remove"></script>
77
<script type="text/javascript" src="common/common.js" class="remove" defer></script>
88
<script type="text/javascript" src="common/jsonld.js" class="remove"></script>
99
<script type="text/javascript" class="remove">
@@ -117,22 +117,9 @@
117117
note: "v1.0" }
118118
],
119119

120-
// name of the WG
121-
wg: "JSON-LD Working Group",
122-
123-
// URI of the public WG page
124-
wgURI: "https://www.w3.org/2018/json-ld-wg/",
125-
126-
// name (with the @w3c.org) of the public mailing to which comments are due
120+
group: "wg/json-ld",
127121
wgPublicList: "public-json-ld-wg",
128122

129-
// URI of the patent status for this WG, for Rec-track documents
130-
// !!!! IMPORTANT !!!!
131-
// This is important for Rec-track documents, do not copy a patent URI from a random
132-
// document unless you know what you're doing. If in doubt ask your friendly neighbourhood
133-
// Team Contact.
134-
wgPatentURI: "https://www.w3.org/2004/01/pp-impl/107714/status",
135-
processVersion: 2018,
136123
maxTocLevel: 2,
137124
alternateFormats: [ {uri: "json-ld11-api.epub", label: "EPUB"} ]
138125
};
@@ -417,18 +404,14 @@ <h2>Terminology</h2>
417404
<p>This document uses the following terms as defined in external specifications
418405
and defines terms specific to JSON-LD.</p>
419406

420-
<div data-include="common/terms.html"
421-
data-oninclude="restrictReferences">
422-
</div>
407+
<div data-include="common/terms.html"></div>
423408

424409
<section>
425410
<h4>Algorithm Terms</h4>
426411

427412
<p>The Following terms are used within specific algorithms.</p>
428413

429-
<div data-include="common/algorithm-terms.html"
430-
data-oninclude="restrictReferences">
431-
</div>
414+
<div data-include="common/algorithm-terms.html"></div>
432415
</section>
433416
<section id="api-keywords">
434417
<h2>Syntax Tokens and Keywords</h2>
@@ -553,7 +536,7 @@ <h2>Expansion</h2>
553536
<button data-selects="expanded">Expanded (Result)</button>
554537
<button data-selects="statements">Statements</button>
555538
<button data-selects="turtle">Turtle</button>
556-
<a class="playground" target="_blank"></a>
539+
<a class="playground" target="_blank" href="#">PG</a>
557540
</div>
558541
<pre class="compacted selected" data-transform="updateExample">
559542
<!--
@@ -619,7 +602,7 @@ <h2>Expansion</h2>
619602
<button data-selects="expanded">Expanded (Result)</button>
620603
<button data-selects="statements">Statements</button>
621604
<button data-selects="turtle">Turtle</button>
622-
<a class="playground" target="_blank"></a>
605+
<a class="playground" target="_blank" href="#">PG</a>
623606
</div>
624607
<pre class="compacted input selected nohighlight" data-transform="updateExample">
625608
<!--
@@ -793,7 +776,8 @@ <h2>Compaction</h2>
793776
data-result-for="#sample-document"
794777
data-context="#sample-document-context"
795778
data-compact
796-
target="_blank"></a>
779+
target="_blank"
780+
href="#">PG</a>
797781
</div>
798782
<pre class="result compacted selected nohighlight" data-transform="updateExample"
799783
data-result-for="Expanded sample document"
@@ -875,7 +859,8 @@ <h2>Flattening</h2>
875859
<a class="playground"
876860
data-result-for="#json-ld-document-in-compact-form"
877861
data-flatten
878-
target="_blank"></a>
862+
target="_blank"
863+
href="#">PG</a>
879864
</div>
880865
<pre class="original result selected nohighlight" data-transform="updateExample"
881866
data-result-for="JSON-LD document in compact form"
@@ -920,7 +905,8 @@ <h2>Flattening</h2>
920905
data-result-for="#json-ld-document-in-compact-form"
921906
data-context="#json-ld-document-in-compact-form"
922907
data-flatten
923-
target="_blank"></a>
908+
target="_blank"
909+
href="#">PG</a>
924910
</div>
925911
<pre class="result selected nohighlight" data-transform="updateExample"
926912
data-result-for="JSON-LD document in compact form"
@@ -6095,7 +6081,7 @@ <h3>Algorithm</h3>
60956081
interface RdfDataset {
60966082
constructor();
60976083
readonly attribute RdfGraph defaultGraph;
6098-
void add(USVString graphName, RdfGraph graph);
6084+
undefined add(USVString graphName, RdfGraph graph);
60996085
iterable&lt;USVString?, RdfGraph>;
61006086
};
61016087
</pre>
@@ -6138,7 +6124,7 @@ <h3>Algorithm</h3>
61386124
[Exposed=JsonLd]
61396125
interface RdfGraph {
61406126
constructor();
6141-
void add(RdfTriple triple);
6127+
undefined add(RdfTriple triple);
61426128
iterable&lt;RdfTriple>;
61436129
};
61446130
</pre>
@@ -7100,6 +7086,13 @@ <h2>Changes since Proposed Recommendation Release of 7 May 2020</h2>
71007086
for non-browser usage to address review suggestions.</li>
71017087
</ul>
71027088
</section>
7089+
<section class="appendix informative" id="changes-from-rec1">
7090+
<h2>Changes since Recommendation of 16 July 2020</h2>
7091+
<ul>
7092+
<li>Regenerated definition list, which does not attempt to filter out unused definitions.</li>
7093+
<li>Changed obsolete use of `void` in WebIDL to `undefined`.</li>
7094+
</ul>
7095+
</section>
71037096
<section id="ack"
71047097
class="appendix informative"
71057098
data-include="ack-script/acknowledgements.html"

0 commit comments

Comments
 (0)