reffy 11.0.3 → 11.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reffy",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.5",
|
|
4
4
|
"description": "W3C/WHATWG spec dependencies exploration companion. Features a short set of tools to study spec references as well as WebIDL term definitions and references found in W3C specifications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"fetch-filecache-for-crawling": "4.1.0",
|
|
40
40
|
"puppeteer": "19.3.0",
|
|
41
41
|
"semver": "^7.3.5",
|
|
42
|
-
"web-specs": "2.
|
|
42
|
+
"web-specs": "2.37.0",
|
|
43
43
|
"webidl2": "24.2.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"nock": "13.2.9",
|
|
49
49
|
"respec": "32.4.0",
|
|
50
50
|
"respec-hljs": "2.1.1",
|
|
51
|
-
"rollup": "3.
|
|
51
|
+
"rollup": "3.6.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"test": "mocha --recursive tests/"
|
|
@@ -240,21 +240,14 @@ export default function () {
|
|
|
240
240
|
// <image> again:
|
|
241
241
|
// https://drafts.csswg.org/css-images-4/#typedef-image
|
|
242
242
|
const isAncestorOf = (ancestor, child) => {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
res = parents[c]
|
|
248
|
-
?.filter(p => !seen.includes(p))
|
|
249
|
-
?.find(p => checkChild(ancestor, p));
|
|
250
|
-
}
|
|
251
|
-
seen = seen.concat(parents[c]);
|
|
252
|
-
return res;
|
|
253
|
-
}
|
|
254
|
-
return checkChild(child);
|
|
243
|
+
const checkChild = (c, depth) =>
|
|
244
|
+
(depth++ < 10) &&
|
|
245
|
+
(c === ancestor || parents[c]?.find(p => checkChild(p, depth)));
|
|
246
|
+
return checkChild(child, 0);
|
|
255
247
|
};
|
|
256
|
-
const isDeepestConstruct = (name, list) =>
|
|
257
|
-
list.every(p => p === name || !isAncestorOf(name, p));
|
|
248
|
+
const isDeepestConstruct = (name, list) => {
|
|
249
|
+
return list.every(p => p === name || !isAncestorOf(name, p));
|
|
250
|
+
}
|
|
258
251
|
|
|
259
252
|
// We may now associate values with dfns
|
|
260
253
|
for (const value of values) {
|
|
@@ -559,10 +552,11 @@ const getDfnName = dfn => {
|
|
|
559
552
|
if (dfn.getAttribute('data-lt')) {
|
|
560
553
|
const names = dfn.getAttribute('data-lt').split('|').map(normalize);
|
|
561
554
|
let name = names.find(n =>
|
|
562
|
-
n.startsWith('<') ||
|
|
563
|
-
n.startsWith('@') ||
|
|
564
|
-
n.startsWith(':') ||
|
|
565
|
-
n.endsWith('()')
|
|
555
|
+
n.startsWith('<') || // Looks like a "type"
|
|
556
|
+
n.startsWith('@') || // Looks like an "at-rule"
|
|
557
|
+
n.startsWith(':') || // Looks like a "descriptor"
|
|
558
|
+
n.endsWith('()') || // Looks like a "function"
|
|
559
|
+
n === dfn.textContent.trim()); // Looks like the right term
|
|
566
560
|
if (!name) {
|
|
567
561
|
if (names.length > 1) {
|
|
568
562
|
throw new Error(`Found multiple linking texts for dfn without any obvious one: ${names.join(', ')}`);
|
|
@@ -646,7 +640,12 @@ const extractTypedDfn = dfn => {
|
|
|
646
640
|
return;
|
|
647
641
|
}
|
|
648
642
|
let code = dd.querySelector('p > code, pre.prod');
|
|
649
|
-
if (code) {
|
|
643
|
+
if (code && !code.closest(informativeSelector)) {
|
|
644
|
+
// The assumption here is that normative code in the <dd> element that
|
|
645
|
+
// follows the definition is the production rule for the definition. This
|
|
646
|
+
// is a rather bold assumption, which should probably be revisited
|
|
647
|
+
// (unrelated code could appear in the prose and not have anything to do
|
|
648
|
+
// with the definition's value)
|
|
650
649
|
if (code.textContent.startsWith(`${text} = `) ||
|
|
651
650
|
code.textContent.startsWith(`<${text}> = `)) {
|
|
652
651
|
res = parseProductionRule(code.textContent, { pureSyntax: true });
|