reffy 11.1.0 → 11.2.0

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.1.0",
3
+ "version": "11.2.0",
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",
@@ -46,7 +46,7 @@
46
46
  "chai": "4.3.7",
47
47
  "mocha": "10.2.0",
48
48
  "nock": "13.2.9",
49
- "respec": "32.5.0",
49
+ "respec": "32.5.1",
50
50
  "respec-hljs": "2.1.1",
51
51
  "rollup": "3.7.4"
52
52
  },
@@ -15,6 +15,7 @@
15
15
  "properties": {
16
16
  "name": { "$ref": "../common.json#/$defs/cssPropertyName" },
17
17
  "value": { "$ref": "../common.json#/$defs/cssValue" },
18
+ "newValues": { "$ref": "../common.json#/$defs/cssValue" },
18
19
  "values": { "$ref": "../common.json#/$defs/cssValues" },
19
20
  "styleDeclaration": {
20
21
  "type": "array",
@@ -260,6 +260,8 @@ export default function (spec, idToHeading = {}) {
260
260
  return node;
261
261
  })
262
262
  .filter(hasValidType)
263
+ // Exclude IDL terms defined in a block that is flagged as to be excluded
264
+ .filter(node => !node.closest('.exclude'))
263
265
  // When the whole term links to an external spec, the definition is an
264
266
  // imported definition. Such definitions are not "real" definitions, let's
265
267
  // skip them.
@@ -216,7 +216,14 @@ export default function (spec) {
216
216
  // All elements defined in MathML Core
217
217
  // use the MathMLElement interface
218
218
  if (shortname === "mathml-core") {
219
- elInfo.interface = "MathMLElement" ;
219
+ elInfo.interface = "MathMLElement" ;
220
+ }
221
+ else {
222
+ const interfaces = [...document.querySelectorAll('dfn[data-dfn-type=interface]')]
223
+ .filter(el => el.textContent.trim().toLowerCase() === `html${elInfo.name}element`);
224
+ if (interfaces.length === 1) {
225
+ elInfo.interface = interfaces[0].textContent.trim();
226
+ }
220
227
  }
221
228
  return elInfo;
222
229
  });
@@ -60,7 +60,8 @@ const modules = {
60
60
  events: require('../postprocessing/events'),
61
61
  idlnames: require('../postprocessing/idlnames'),
62
62
  idlparsed: require('../postprocessing/idlparsed'),
63
- annotatelinks: require('../postprocessing/annotate-links')
63
+ annotatelinks: require('../postprocessing/annotate-links'),
64
+ patchdfns: require('../postprocessing/patch-dfns')
64
65
  };
65
66
 
66
67
 
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Post-processing module that can be used to patch definition extracts,
3
+ * typically to drop problematic duplicate definitions they may contain.
4
+ *
5
+ * This post-processing module should only be considered as last resort because
6
+ * it requires manual maintenance over time. Goal is to hardcode things here
7
+ * only when duplicate terms create actual referencing issues, not to resolve
8
+ * all duplicate definitions conflicts.
9
+ *
10
+ * The module runs at the spec level.
11
+ */
12
+
13
+ module.exports = {
14
+ dependsOn: ['dfns'],
15
+ input: 'spec',
16
+ property: 'dfns',
17
+
18
+ run: async function (spec, options) {
19
+ // Note the spec object passed to post-processing modules does not contain
20
+ // any specific detail on the spec other than the crawled URL, so no direct
21
+ // way to match spec on its shortname
22
+ if (spec.crawled && spec.dfns) {
23
+ // https://github.com/w3c/webref/blob/main/ed/idlpatches/orientation-event.idl.patch
24
+ if (spec.crawled.includes('/deviceorientation/') ||
25
+ spec.crawled.includes('/TR/orientation-event/')) {
26
+ spec.dfns = spec.dfns.filter(dfn =>
27
+ !dfn.linkingText.includes('PermissionState') &&
28
+ !dfn.for.includes('PermissionState'));
29
+ }
30
+
31
+ // https://github.com/w3c/webref/blob/main/ed/idlpatches/portals.idl.patch
32
+ else if (spec.crawled.includes('/portals/')) {
33
+ spec.dfns = spec.dfns.filter(dfn =>
34
+ dfn.linkingText[0] !== 'MessageEventSource');
35
+ }
36
+ }
37
+
38
+ return spec;
39
+ }
40
+ };