reffy 14.7.0 → 14.8.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": "14.
|
|
3
|
+
"version": "14.8.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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"ajv-formats": "2.1.1",
|
|
37
37
|
"commander": "12.0.0",
|
|
38
38
|
"fetch-filecache-for-crawling": "5.1.1",
|
|
39
|
-
"puppeteer": "22.
|
|
39
|
+
"puppeteer": "22.2.0",
|
|
40
40
|
"semver": "^7.3.5",
|
|
41
41
|
"web-specs": "3.3.0",
|
|
42
42
|
"webidl2": "24.4.1"
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
"items": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
|
9
|
-
"required": ["name"],
|
|
9
|
+
"required": ["name", "href"],
|
|
10
10
|
"properties": {
|
|
11
11
|
"name": { "type": "string" },
|
|
12
12
|
"interface": { "$ref": "../common.json#/$defs/interface" },
|
|
13
|
+
"href": { "$ref": "../common.json#/$defs/url" },
|
|
13
14
|
"obsolete": { "type": "boolean" }
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import getAbsoluteUrl from './get-absolute-url.mjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Extract the list of markup elements that the spec defines
|
|
3
5
|
*
|
|
@@ -43,7 +45,10 @@ export default function (spec) {
|
|
|
43
45
|
// In most cases, there will be only one element, but some elements are
|
|
44
46
|
// defined together, typically h1-h6 or sub and sup
|
|
45
47
|
return dfns.map(dfn => {
|
|
46
|
-
const res = {
|
|
48
|
+
const res = {
|
|
49
|
+
name: getText(dfn),
|
|
50
|
+
href: getAbsoluteUrl(dfn)
|
|
51
|
+
};
|
|
47
52
|
const dts = [...el.querySelectorAll('dt')];
|
|
48
53
|
dts.forEach(dt => {
|
|
49
54
|
const prop = ({
|
|
@@ -143,8 +148,27 @@ export default function (spec) {
|
|
|
143
148
|
if (!name) {
|
|
144
149
|
throw new Error('Could not extract name from element-summary element');
|
|
145
150
|
}
|
|
151
|
+
let dfn = el.querySelector('dfn');
|
|
152
|
+
if (!dfn) {
|
|
153
|
+
// The SVG 1.1 spec does not use dfns, look for an ID on the parent div
|
|
154
|
+
// if defined (happens when there are multiple elements defined in the
|
|
155
|
+
// same section) or at a nearby heading (all other cases).
|
|
156
|
+
dfn = el.parentElement;
|
|
157
|
+
if (!dfn.id) {
|
|
158
|
+
dfn = el.previousElementSibling;
|
|
159
|
+
while (dfn && !dfn.nodeName.match(/^H\d$/)) {
|
|
160
|
+
dfn = dfn.previousElementSibling;
|
|
161
|
+
}
|
|
162
|
+
if (!dfn) {
|
|
163
|
+
throw new Error('Could not locate heading associated with element ' + getText(name));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
146
167
|
|
|
147
|
-
const res = {
|
|
168
|
+
const res = {
|
|
169
|
+
name: getText(name).replace(/‘|’/g, ''),
|
|
170
|
+
href: getAbsoluteUrl(dfn)
|
|
171
|
+
};
|
|
148
172
|
const dts = [...el.querySelectorAll('dt')];
|
|
149
173
|
dts.forEach(dt => {
|
|
150
174
|
const prop = ({
|
|
@@ -180,7 +204,10 @@ export default function (spec) {
|
|
|
180
204
|
throw new Error('Could not extract name from definition-table element');
|
|
181
205
|
}
|
|
182
206
|
|
|
183
|
-
const res = {
|
|
207
|
+
const res = {
|
|
208
|
+
name: getText(dfn),
|
|
209
|
+
href: getAbsoluteUrl(dfn)
|
|
210
|
+
};
|
|
184
211
|
const ths = [...el.querySelectorAll('th')];
|
|
185
212
|
ths.forEach(th => {
|
|
186
213
|
const prop = ({
|
|
@@ -212,7 +239,10 @@ export default function (spec) {
|
|
|
212
239
|
const shortname = (typeof spec === 'string') ? spec : spec.shortname;
|
|
213
240
|
const otherElements = [...document.querySelectorAll('dfn[data-dfn-type="element"]')]
|
|
214
241
|
.map(el => {
|
|
215
|
-
const elInfo = {
|
|
242
|
+
const elInfo = {
|
|
243
|
+
name: el.textContent.trim(),
|
|
244
|
+
href: getAbsoluteUrl(el)
|
|
245
|
+
};
|
|
216
246
|
// All elements defined in MathML Core
|
|
217
247
|
// use the MathMLElement interface
|
|
218
248
|
if (shortname === "mathml-core") {
|