reffy 8.0.1 → 8.0.2

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": "8.0.1",
3
+ "version": "8.0.2",
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",
@@ -42,7 +42,7 @@
42
42
  "devDependencies": {
43
43
  "chai": "4.3.6",
44
44
  "mocha": "10.0.0",
45
- "nock": "13.2.8",
45
+ "nock": "13.2.9",
46
46
  "respec": "32.1.10",
47
47
  "respec-hljs": "2.1.1",
48
48
  "rollup": "2.77.0"
@@ -257,10 +257,22 @@ const extractValueSpaces = doc => {
257
257
  // https://drafts.csswg.org/css-easing-2/#typedef-step-easing-function
258
258
  const prod = text.split(reSplitRules)
259
259
  .find(p => p.trim().startsWith(dfn.textContent.trim()));
260
- if (!prod) {
261
- throw new Error(`Production rule for ${dfn.textContent.trim()} found has unexpected format`);
260
+ if (prod) {
261
+ parseProductionRule(prod, { pureSyntax: true });
262
+ }
263
+ else {
264
+ // "=" may appear in another formula in the body of the text, as in:
265
+ // https://drafts.csswg.org/css-speech-1/#typedef-voice-volume-decibel
266
+ // It may be worth checking but not an error per se.
267
+ console.warn('[reffy]', `Found "=" next to definition of ${dfn.textContent.trim()} but no production rule. Did I miss something?`);
268
+ const name = (dfn.getAttribute('data-lt') ?? dfn.textContent)
269
+ .trim().replace(/^<?(.*?)>?$/, '<$1>');
270
+ if (!(name in res)) {
271
+ res[name] = {
272
+ prose: parent.textContent.trim().replace(/\s+/g, ' ')
273
+ };
274
+ }
262
275
  }
263
- parseProductionRule(prod, { pureSyntax: true });
264
276
  }
265
277
  else if (dfn.textContent.trim().match(/^[a-zA-Z_][a-zA-Z0-9_\-]+\([^\)]+\)$/)) {
266
278
  // Definition is "prod(foo bar)", create a "prod() = prod(foo bar)" entry
@@ -55,11 +55,13 @@ module.exports = {
55
55
  .map(event => {
56
56
  const err = extendEvent(event, events);
57
57
  if (err) {
58
+ // Event could not be extended, let's keep extension event
58
59
  console.warn(err);
59
- return event;
60
+ return null;
60
61
  }
61
62
  else {
62
- return null;
63
+ // Event successfully extended, extension can be dropped
64
+ return event;
63
65
  }
64
66
  })
65
67
  .filter(event => !!event);