reffy 10.0.2 → 10.0.3
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 +1 -1
- package/src/browserlib/extract-headings.mjs +1 -0
- package/src/browserlib/extract-references.mjs +4 -1
- package/src/browserlib/get-absolute-url.mjs +4 -1
- package/src/browserlib/map-ids-to-headings.mjs +14 -10
- package/src/cli/parse-webidl.js +1 -0
- package/src/lib/post-processor.js +9 -0
- package/src/lib/specs-crawler.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reffy",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.3",
|
|
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",
|
|
@@ -13,6 +13,7 @@ export default function (spec, idToHeading) {
|
|
|
13
13
|
const headingLevel = headingNumber ? headingNumber.split(".").length : undefined;
|
|
14
14
|
return {
|
|
15
15
|
id: n.parentNode.id,
|
|
16
|
+
href: getAbsoluteUrl(n.parentNode, { singlePage }),
|
|
16
17
|
title: n.textContent.replace(headingNumber, '').trim(),
|
|
17
18
|
level: headingLevel,
|
|
18
19
|
number: headingNumber
|
|
@@ -101,7 +101,10 @@ function parseReferences(referenceList, options) {
|
|
|
101
101
|
if (!desc || !ref.name) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
const url = desc.querySelector('a[href*="://"]')?.href;
|
|
105
|
+
if (url) {
|
|
106
|
+
ref.url = url;
|
|
107
|
+
}
|
|
105
108
|
if (options.filterInformative &&
|
|
106
109
|
desc.textContent.match(/non-normative/i)) {
|
|
107
110
|
return informativeRef.push(ref);
|
|
@@ -16,6 +16,9 @@ export default function (node, { singlePage, attribute } =
|
|
|
16
16
|
const page = singlePage ? null :
|
|
17
17
|
node.closest('[data-reffy-page]')?.getAttribute('data-reffy-page');
|
|
18
18
|
const url = new URL(page ?? window.location.href);
|
|
19
|
-
|
|
19
|
+
const hashid = node.getAttribute(attribute);
|
|
20
|
+
if (hashid) {
|
|
21
|
+
url.hash = '#' + hashid;
|
|
22
|
+
}
|
|
20
23
|
return url.toString();
|
|
21
24
|
}
|
|
@@ -79,11 +79,13 @@ export default function () {
|
|
|
79
79
|
const match = trimmedText.match(reNumber);
|
|
80
80
|
const number = match ? match[1] : null;
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const mapping = {};
|
|
83
|
+
if (id) {
|
|
84
|
+
mapping.id = id;
|
|
85
|
+
}
|
|
86
|
+
mapping.href = href;
|
|
87
|
+
mapping.title = trimmedText.replace(reNumber, '').trim().replace(/\s+/g, ' ');
|
|
88
|
+
mappingTable[nodeid] = mapping;
|
|
87
89
|
|
|
88
90
|
if (number) {
|
|
89
91
|
// Store the number without the final "."
|
|
@@ -120,11 +122,13 @@ function esMapIdToHeadings() {
|
|
|
120
122
|
const match = trimmedText.match(reNumber);
|
|
121
123
|
const number = match ? match[1] : null;
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const mapping = {};
|
|
126
|
+
if (section.id) {
|
|
127
|
+
mapping.id = section.id;
|
|
128
|
+
}
|
|
129
|
+
mapping.href = href;
|
|
130
|
+
mapping.title = trimmedText.replace(reNumber, '').trim().replace(/\s+/g, ' ');
|
|
131
|
+
mappingTable[nodeid] = mapping;
|
|
128
132
|
|
|
129
133
|
if (number) {
|
|
130
134
|
// Store the number without the final "."
|
package/src/cli/parse-webidl.js
CHANGED
|
@@ -362,6 +362,7 @@ function parseType(idltype, idlReport, contextName) {
|
|
|
362
362
|
"short", "unsigned short",
|
|
363
363
|
"long", "unsigned long", "long long", "unsigned long long",
|
|
364
364
|
"float", "unrestricted float", "double", "unrestricted double",
|
|
365
|
+
"bigint",
|
|
365
366
|
"DOMString", "ByteString", "USVString",
|
|
366
367
|
"object"
|
|
367
368
|
];
|
|
@@ -249,6 +249,14 @@ function dependsOn(mod) {
|
|
|
249
249
|
return mod.dependsOn;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Return the name of the property that will be set in the spec crawl result
|
|
254
|
+
* when the post-processing module runs, if any
|
|
255
|
+
*/
|
|
256
|
+
function getProperty(mod) {
|
|
257
|
+
mod = getModule(mod);
|
|
258
|
+
return mod.property ?? mod.name;
|
|
259
|
+
}
|
|
252
260
|
|
|
253
261
|
function appliesAtLevel(mod, level) {
|
|
254
262
|
mod = getModule(mod);
|
|
@@ -266,5 +274,6 @@ module.exports = {
|
|
|
266
274
|
run, save,
|
|
267
275
|
extractsPerSeries,
|
|
268
276
|
dependsOn,
|
|
277
|
+
getProperty,
|
|
269
278
|
appliesAtLevel
|
|
270
279
|
};
|
package/src/lib/specs-crawler.js
CHANGED
|
@@ -130,7 +130,7 @@ async function crawlSpec(spec, crawlOptions) {
|
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
crawlOptions.post?.forEach(mod => {
|
|
133
|
-
const prop =
|
|
133
|
+
const prop = postProcessor.getProperty(mod);
|
|
134
134
|
if (postProcessor.appliesAtLevel(mod, 'spec') && result[prop]) {
|
|
135
135
|
spec[prop] = result[prop];
|
|
136
136
|
}
|