reffy 19.1.0 → 19.1.1

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": "19.1.0",
3
+ "version": "19.1.1",
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,13 +39,13 @@
39
39
  "fetch-filecache-for-crawling": "5.1.1",
40
40
  "puppeteer": "24.12.1",
41
41
  "semver": "^7.3.5",
42
- "web-specs": "3.56.0",
42
+ "web-specs": "3.57.0",
43
43
  "webidl2": "24.4.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "respec": "35.4.2",
47
47
  "respec-hljs": "2.1.1",
48
- "rollup": "4.44.2",
48
+ "rollup": "4.45.0",
49
49
  "undici": "^7.0.0"
50
50
  },
51
51
  "overrides": {
@@ -24,6 +24,8 @@ import {parse} from "../../node_modules/webidl2/index.js";
24
24
  * can be one of "dt", "pre", "table", "heading", "note", "example", or
25
25
  * "prose" (last one indicates that definition appears in the main body of
26
26
  * the spec)
27
+ * - links: A list of interesting links with IDs that complete the definitions,
28
+ * notably non-normative descriptions that target web developers.
27
29
  *
28
30
  * The extraction ignores definitions with an unknown type. A warning is issued
29
31
  * to the console when that happens.
@@ -20,12 +20,29 @@ export default function (spec, idToHeading) {
20
20
  };
21
21
  });
22
22
 
23
+ // Headings using spans in www.rfc-editor.org RFCs
24
+ const rfcSelector = 'pre > span:is(.h2,.h3,.h4,.h5,.h6) > a.selflink[id]';
25
+ const rfcHeadings = [...document.querySelectorAll(rfcSelector)].map(n => {
26
+ const headingNumber = n.textContent;
27
+ const headingLevel = headingNumber ? headingNumber.split(".").length : undefined;
28
+ return {
29
+ id: n.id,
30
+ href: getAbsoluteUrl(n, { singlePage }),
31
+ title: n.parentNode.textContent
32
+ .replace(headingNumber, '')
33
+ .replace(/^\s*\./, '')
34
+ .trim(),
35
+ level: headingLevel,
36
+ number: headingNumber
37
+ };
38
+ });
39
+
23
40
  const headingsSelector = [
24
41
  ':is(h1,h2,h3,h4,h5,h6)[id]', // Regular headings
25
42
  ':is(h1,h2,h3,h4,h5,h6):not([id]) > a[name]' // CSS 2.1 headings
26
43
  ].join(',');
27
44
 
28
- return esHeadings.concat([...document.querySelectorAll(headingsSelector)].map(n => {
45
+ return esHeadings.concat(rfcHeadings).concat([...document.querySelectorAll(headingsSelector)].map(n => {
29
46
  // Note: In theory, all <hX> heading elements that have an ID are associated
30
47
  // with a heading in idToHeading. One exception to the rule: when the
31
48
  // heading element appears in a <hgroup> element, the mapping is not