reffy 20.0.13 → 20.0.14
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/LICENSE +21 -21
- package/README.md +151 -151
- package/index.js +29 -29
- package/package.json +3 -3
- package/reffy.js +324 -324
- package/schemas/browserlib/extract-algorithms.json +52 -52
- package/schemas/browserlib/extract-cssdfn.json +108 -108
- package/schemas/browserlib/extract-dfns.json +90 -90
- package/schemas/browserlib/extract-elements.json +17 -17
- package/schemas/browserlib/extract-events.json +31 -31
- package/schemas/browserlib/extract-headings.json +19 -19
- package/schemas/browserlib/extract-ids.json +7 -7
- package/schemas/browserlib/extract-links.json +12 -12
- package/schemas/browserlib/extract-refs.json +12 -12
- package/schemas/common.json +876 -876
- package/schemas/files/extracts/algorithms.json +12 -12
- package/schemas/files/extracts/css.json +16 -16
- package/schemas/files/extracts/dfns.json +12 -12
- package/schemas/files/extracts/elements.json +12 -12
- package/schemas/files/extracts/events.json +12 -12
- package/schemas/files/extracts/headings.json +12 -12
- package/schemas/files/extracts/ids.json +12 -12
- package/schemas/files/extracts/links.json +12 -12
- package/schemas/files/extracts/refs.json +12 -12
- package/schemas/files/index.json +59 -59
- package/schemas/postprocessing/events.json +50 -50
- package/schemas/postprocessing/idlnames-parsed.json +27 -27
- package/schemas/postprocessing/idlnames.json +17 -17
- package/schemas/postprocessing/idlparsed.json +67 -67
- package/src/browserlib/clone-and-clean.mjs +24 -24
- package/src/browserlib/create-outline.mjs +353 -353
- package/src/browserlib/extract-algorithms.mjs +723 -723
- package/src/browserlib/extract-cddl.mjs +125 -125
- package/src/browserlib/extract-dfns.mjs +1093 -1093
- package/src/browserlib/extract-headings.mjs +76 -76
- package/src/browserlib/extract-ids.mjs +28 -28
- package/src/browserlib/extract-links.mjs +45 -45
- package/src/browserlib/extract-references.mjs +308 -308
- package/src/browserlib/extract-webidl.mjs +89 -89
- package/src/browserlib/get-absolute-url.mjs +29 -29
- package/src/browserlib/get-code-elements.mjs +20 -20
- package/src/browserlib/get-generator.mjs +26 -26
- package/src/browserlib/get-lastmodified-date.mjs +13 -13
- package/src/browserlib/get-revision.mjs +12 -12
- package/src/browserlib/get-title.mjs +14 -14
- package/src/browserlib/informative-selector.mjs +24 -24
- package/src/browserlib/map-ids-to-headings.mjs +173 -173
- package/src/browserlib/reffy.json +85 -85
- package/src/browserlib/trim-spaces.mjs +35 -35
- package/src/cli/check-missing-dfns.js +587 -587
- package/src/cli/merge-crawl-results.js +132 -132
- package/src/cli/parse-webidl.js +447 -447
- package/src/lib/css-grammar-parse-tree.schema.json +109 -109
- package/src/lib/css-grammar-parser.js +440 -440
- package/src/lib/fetch.js +51 -51
- package/src/lib/markdown-report.js +360 -360
- package/src/lib/mock-server.js +218 -218
- package/src/lib/post-processor.js +322 -322
- package/src/lib/throttled-queue.js +129 -129
- package/src/postprocessing/annotate-links.js +41 -41
- package/src/postprocessing/csscomplete.js +48 -48
- package/src/postprocessing/idlnames.js +391 -391
- package/src/postprocessing/idlparsed.js +179 -179
- package/src/postprocessing/patch-dfns.js +51 -51
- package/src/specs/missing-css-rules.json +197 -197
- package/src/specs/spec-equivalents.json +149 -149
- package/src/browserlib/extract-editors.mjs~ +0 -14
- package/src/browserlib/extract-events.mjs~ +0 -3
- package/src/browserlib/generate-es-dfn-report.sh~ +0 -4
- package/src/browserlib/get-revision.mjs~ +0 -7
- package/src/cli/csstree-grammar-check.js +0 -28
- package/src/cli/csstree-grammar-check.js~ +0 -10
- package/src/cli/csstree-grammar-parser.js +0 -11
- package/src/cli/csstree-grammar-parser.js~ +0 -1
- package/src/cli/extract-editors.js~ +0 -38
- package/src/cli/process-specs.js~ +0 -28
- package/src/postprocessing/annotate-links.js~ +0 -8
- package/src/postprocessing/events.js~ +0 -245
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper function to sleep for a specified number of milliseconds
|
|
3
|
-
*/
|
|
4
|
-
function sleep(ms) {
|
|
5
|
-
return new Promise(resolve => setTimeout(resolve, ms, 'slept'));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Helper function that returns the "origin" of a URL, defined in a loose way
|
|
11
|
-
* as the part of the true origin that identifies the server that's going to
|
|
12
|
-
* serve the resource.
|
|
13
|
-
*
|
|
14
|
-
* For example "github.io" for all specs under github.io, "whatwg.org" for
|
|
15
|
-
* all WHATWG specs, "csswg.org" for CSS specs at large (including Houdini
|
|
16
|
-
* and FXTF specs since they are served by the same server).
|
|
17
|
-
*/
|
|
18
|
-
function getOrigin(url) {
|
|
19
|
-
if (!url) {
|
|
20
|
-
return '';
|
|
21
|
-
}
|
|
22
|
-
const origin = (new URL(url)).origin;
|
|
23
|
-
if (origin.endsWith('.whatwg.org')) {
|
|
24
|
-
return 'https://whatwg.org';
|
|
25
|
-
}
|
|
26
|
-
else if (origin.endsWith('.github.io')) {
|
|
27
|
-
return 'https://github.io';
|
|
28
|
-
}
|
|
29
|
-
else if (origin.endsWith('.csswg.org') ||
|
|
30
|
-
origin.endsWith('.css-houdini.org') ||
|
|
31
|
-
origin.endsWith('.fxtf.org')) {
|
|
32
|
-
return 'https://csswg.org';
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return origin;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The ThrottledQueue class can be used to run a series of tasks that send
|
|
42
|
-
* network requests to an origin server in parallel, up to a certain limit,
|
|
43
|
-
* while guaranteeing that only one request will be sent to a given origin
|
|
44
|
-
* server at a time.
|
|
45
|
-
*/
|
|
46
|
-
export default class ThrottledQueue {
|
|
47
|
-
originQueue = {};
|
|
48
|
-
maxParallel = 4;
|
|
49
|
-
sleepInterval = 2000;
|
|
50
|
-
ongoing = 0;
|
|
51
|
-
pending = [];
|
|
52
|
-
|
|
53
|
-
constructor(options = { maxParallel: 4, sleepInterval: 2000 }) {
|
|
54
|
-
if (options.maxParallel >= 0) {
|
|
55
|
-
this.maxParallel = options.maxParallel;
|
|
56
|
-
}
|
|
57
|
-
if (options.sleepInterval) {
|
|
58
|
-
this.sleepInterval = options.sleepInterval;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Run the given processing function with the given parameters, immediately
|
|
64
|
-
* if possible or as soon as possible when too many tasks are already running
|
|
65
|
-
* in parallel.
|
|
66
|
-
*
|
|
67
|
-
* Note this function has no notion of origin. Users may call the function
|
|
68
|
-
* directly if they don't need any throttling per origin.
|
|
69
|
-
*/
|
|
70
|
-
async runThrottled(processFunction, ...params) {
|
|
71
|
-
if (this.ongoing >= this.maxParallel) {
|
|
72
|
-
return new Promise((resolve, reject) => {
|
|
73
|
-
this.pending.push({ params, resolve, reject });
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
this.ongoing += 1;
|
|
78
|
-
const result = await processFunction.call(null, ...params);
|
|
79
|
-
this.ongoing -= 1;
|
|
80
|
-
|
|
81
|
-
// Done with current task, trigger next pending task in the background
|
|
82
|
-
setTimeout(_ => {
|
|
83
|
-
if (this.pending.length && this.ongoing < this.maxParallel) {
|
|
84
|
-
const next = this.pending.shift();
|
|
85
|
-
this.runThrottled(processFunction, ...next.params)
|
|
86
|
-
.then(result => next.resolve(result))
|
|
87
|
-
.catch(err => next.reject(err));
|
|
88
|
-
}
|
|
89
|
-
}, 0);
|
|
90
|
-
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Run the given processing function with the given parameters, immediately
|
|
97
|
-
* if possible or as soon as possible when too many tasks are already running
|
|
98
|
-
* in parallel, or when there's already a task being run against the same
|
|
99
|
-
* origin as that of the provided URL.
|
|
100
|
-
*
|
|
101
|
-
* Said differently, the function serializes tasks per origin, and calls
|
|
102
|
-
* "runThrottled" to restrict the number of tasks that run in parallel to the
|
|
103
|
-
* requested maximum.
|
|
104
|
-
*
|
|
105
|
-
* Additionally, the function forces a 2 second sleep after processing to
|
|
106
|
-
* keep a low network profile (sleeping time can be adjusted per origin
|
|
107
|
-
* depending if the sleepInterval parameter that was passed to the
|
|
108
|
-
* constructor is a function.
|
|
109
|
-
*/
|
|
110
|
-
async runThrottledPerOrigin(url, processFunction, ...params) {
|
|
111
|
-
const origin = getOrigin(url);
|
|
112
|
-
if (!this.originQueue[origin]) {
|
|
113
|
-
this.originQueue[origin] = Promise.resolve(true);
|
|
114
|
-
}
|
|
115
|
-
return new Promise((resolve, reject) => {
|
|
116
|
-
this.originQueue[origin] = this.originQueue[origin]
|
|
117
|
-
.then(async _ => this.runThrottled(processFunction, ...params))
|
|
118
|
-
.then(async result => {
|
|
119
|
-
const interval = (typeof this.sleepInterval === 'function') ?
|
|
120
|
-
this.sleepInterval(origin) :
|
|
121
|
-
this.sleepInterval;
|
|
122
|
-
await sleep(interval);
|
|
123
|
-
return result;
|
|
124
|
-
})
|
|
125
|
-
.then(resolve)
|
|
126
|
-
.catch(reject);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to sleep for a specified number of milliseconds
|
|
3
|
+
*/
|
|
4
|
+
function sleep(ms) {
|
|
5
|
+
return new Promise(resolve => setTimeout(resolve, ms, 'slept'));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Helper function that returns the "origin" of a URL, defined in a loose way
|
|
11
|
+
* as the part of the true origin that identifies the server that's going to
|
|
12
|
+
* serve the resource.
|
|
13
|
+
*
|
|
14
|
+
* For example "github.io" for all specs under github.io, "whatwg.org" for
|
|
15
|
+
* all WHATWG specs, "csswg.org" for CSS specs at large (including Houdini
|
|
16
|
+
* and FXTF specs since they are served by the same server).
|
|
17
|
+
*/
|
|
18
|
+
function getOrigin(url) {
|
|
19
|
+
if (!url) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
const origin = (new URL(url)).origin;
|
|
23
|
+
if (origin.endsWith('.whatwg.org')) {
|
|
24
|
+
return 'https://whatwg.org';
|
|
25
|
+
}
|
|
26
|
+
else if (origin.endsWith('.github.io')) {
|
|
27
|
+
return 'https://github.io';
|
|
28
|
+
}
|
|
29
|
+
else if (origin.endsWith('.csswg.org') ||
|
|
30
|
+
origin.endsWith('.css-houdini.org') ||
|
|
31
|
+
origin.endsWith('.fxtf.org')) {
|
|
32
|
+
return 'https://csswg.org';
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return origin;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The ThrottledQueue class can be used to run a series of tasks that send
|
|
42
|
+
* network requests to an origin server in parallel, up to a certain limit,
|
|
43
|
+
* while guaranteeing that only one request will be sent to a given origin
|
|
44
|
+
* server at a time.
|
|
45
|
+
*/
|
|
46
|
+
export default class ThrottledQueue {
|
|
47
|
+
originQueue = {};
|
|
48
|
+
maxParallel = 4;
|
|
49
|
+
sleepInterval = 2000;
|
|
50
|
+
ongoing = 0;
|
|
51
|
+
pending = [];
|
|
52
|
+
|
|
53
|
+
constructor(options = { maxParallel: 4, sleepInterval: 2000 }) {
|
|
54
|
+
if (options.maxParallel >= 0) {
|
|
55
|
+
this.maxParallel = options.maxParallel;
|
|
56
|
+
}
|
|
57
|
+
if (options.sleepInterval) {
|
|
58
|
+
this.sleepInterval = options.sleepInterval;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Run the given processing function with the given parameters, immediately
|
|
64
|
+
* if possible or as soon as possible when too many tasks are already running
|
|
65
|
+
* in parallel.
|
|
66
|
+
*
|
|
67
|
+
* Note this function has no notion of origin. Users may call the function
|
|
68
|
+
* directly if they don't need any throttling per origin.
|
|
69
|
+
*/
|
|
70
|
+
async runThrottled(processFunction, ...params) {
|
|
71
|
+
if (this.ongoing >= this.maxParallel) {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
this.pending.push({ params, resolve, reject });
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.ongoing += 1;
|
|
78
|
+
const result = await processFunction.call(null, ...params);
|
|
79
|
+
this.ongoing -= 1;
|
|
80
|
+
|
|
81
|
+
// Done with current task, trigger next pending task in the background
|
|
82
|
+
setTimeout(_ => {
|
|
83
|
+
if (this.pending.length && this.ongoing < this.maxParallel) {
|
|
84
|
+
const next = this.pending.shift();
|
|
85
|
+
this.runThrottled(processFunction, ...next.params)
|
|
86
|
+
.then(result => next.resolve(result))
|
|
87
|
+
.catch(err => next.reject(err));
|
|
88
|
+
}
|
|
89
|
+
}, 0);
|
|
90
|
+
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Run the given processing function with the given parameters, immediately
|
|
97
|
+
* if possible or as soon as possible when too many tasks are already running
|
|
98
|
+
* in parallel, or when there's already a task being run against the same
|
|
99
|
+
* origin as that of the provided URL.
|
|
100
|
+
*
|
|
101
|
+
* Said differently, the function serializes tasks per origin, and calls
|
|
102
|
+
* "runThrottled" to restrict the number of tasks that run in parallel to the
|
|
103
|
+
* requested maximum.
|
|
104
|
+
*
|
|
105
|
+
* Additionally, the function forces a 2 second sleep after processing to
|
|
106
|
+
* keep a low network profile (sleeping time can be adjusted per origin
|
|
107
|
+
* depending if the sleepInterval parameter that was passed to the
|
|
108
|
+
* constructor is a function.
|
|
109
|
+
*/
|
|
110
|
+
async runThrottledPerOrigin(url, processFunction, ...params) {
|
|
111
|
+
const origin = getOrigin(url);
|
|
112
|
+
if (!this.originQueue[origin]) {
|
|
113
|
+
this.originQueue[origin] = Promise.resolve(true);
|
|
114
|
+
}
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
this.originQueue[origin] = this.originQueue[origin]
|
|
117
|
+
.then(async _ => this.runThrottled(processFunction, ...params))
|
|
118
|
+
.then(async result => {
|
|
119
|
+
const interval = (typeof this.sleepInterval === 'function') ?
|
|
120
|
+
this.sleepInterval(origin) :
|
|
121
|
+
this.sleepInterval;
|
|
122
|
+
await sleep(interval);
|
|
123
|
+
return result;
|
|
124
|
+
})
|
|
125
|
+
.then(resolve)
|
|
126
|
+
.catch(reject);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-processing module that annotates links extracts with the spec
|
|
3
|
-
shortname they link to
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
function canonicalizeUrl(url) {
|
|
7
|
-
return url.replace(/^http:/, 'https:')
|
|
8
|
-
.split('#')[0]
|
|
9
|
-
.replace('index.html', '')
|
|
10
|
-
.replace('Overview.html', '')
|
|
11
|
-
.replace('cover.html', '')
|
|
12
|
-
.replace(/spec.whatwg.org\/.*/, 'spec.whatwg.org/') // subpage to main document in whatwg
|
|
13
|
-
.replace(/w3.org\/TR\/(([^\/]+\/)+)[^\/]+\.[^\/]+$/, 'w3.org/TR/$1') // subpage to main document in w3c
|
|
14
|
-
.replace(/w3.org\/TR\/([^\/]+)$/, 'w3.org/TR/$1/') // enforce trailing slash
|
|
15
|
-
.replace(/w3c.github.io\/([^\/]+)$/, 'w3c.github.io/$1/') // enforce trailing slash for ED on GitHub
|
|
16
|
-
;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const needsSaving = {};
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
dependsOn: ['links'],
|
|
23
|
-
input: 'spec',
|
|
24
|
-
|
|
25
|
-
run: function(spec, {speclist}) {
|
|
26
|
-
if (!speclist || !speclist.length) {
|
|
27
|
-
console.error("No spec list passed as input, cannot annotate links in post-processing");
|
|
28
|
-
return spec;
|
|
29
|
-
}
|
|
30
|
-
for (let link in (spec.links || {})) {
|
|
31
|
-
// Annotate with the spec to which the page belong if we can find one
|
|
32
|
-
const specUrl = canonicalizeUrl(link);
|
|
33
|
-
let matchingSpec = speclist.find(s => s?.release?.url === specUrl || s?.nightly?.url === specUrl || (s?.series?.currentSpecification === s?.shortname && (s?.series?.nightlyUrl === specUrl || s?.series?.releaseUrl === specUrl)) || s?.nightly?.pages?.includes(specUrl) || s?.release?.pages?.includes(specUrl));
|
|
34
|
-
if (matchingSpec) {
|
|
35
|
-
spec.links[link].specShortname = matchingSpec.shortname;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return spec;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Post-processing module that annotates links extracts with the spec
|
|
3
|
+
shortname they link to
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
function canonicalizeUrl(url) {
|
|
7
|
+
return url.replace(/^http:/, 'https:')
|
|
8
|
+
.split('#')[0]
|
|
9
|
+
.replace('index.html', '')
|
|
10
|
+
.replace('Overview.html', '')
|
|
11
|
+
.replace('cover.html', '')
|
|
12
|
+
.replace(/spec.whatwg.org\/.*/, 'spec.whatwg.org/') // subpage to main document in whatwg
|
|
13
|
+
.replace(/w3.org\/TR\/(([^\/]+\/)+)[^\/]+\.[^\/]+$/, 'w3.org/TR/$1') // subpage to main document in w3c
|
|
14
|
+
.replace(/w3.org\/TR\/([^\/]+)$/, 'w3.org/TR/$1/') // enforce trailing slash
|
|
15
|
+
.replace(/w3c.github.io\/([^\/]+)$/, 'w3c.github.io/$1/') // enforce trailing slash for ED on GitHub
|
|
16
|
+
;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const needsSaving = {};
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
dependsOn: ['links'],
|
|
23
|
+
input: 'spec',
|
|
24
|
+
|
|
25
|
+
run: function(spec, {speclist}) {
|
|
26
|
+
if (!speclist || !speclist.length) {
|
|
27
|
+
console.error("No spec list passed as input, cannot annotate links in post-processing");
|
|
28
|
+
return spec;
|
|
29
|
+
}
|
|
30
|
+
for (let link in (spec.links || {})) {
|
|
31
|
+
// Annotate with the spec to which the page belong if we can find one
|
|
32
|
+
const specUrl = canonicalizeUrl(link);
|
|
33
|
+
let matchingSpec = speclist.find(s => s?.release?.url === specUrl || s?.nightly?.url === specUrl || (s?.series?.currentSpecification === s?.shortname && (s?.series?.nightlyUrl === specUrl || s?.series?.releaseUrl === specUrl)) || s?.nightly?.pages?.includes(specUrl) || s?.release?.pages?.includes(specUrl));
|
|
34
|
+
if (matchingSpec) {
|
|
35
|
+
spec.links[link].specShortname = matchingSpec.shortname;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return spec;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-processing module that adds CSS property definitions found in prose
|
|
3
|
-
* from the dfns extract, clean up property definitions that should never have
|
|
4
|
-
* been extracted, and adds the generated IDL attribute names in a
|
|
5
|
-
* styleDeclaration sub-property.
|
|
6
|
-
*
|
|
7
|
-
* Module runs at the spec level. It does not create a distinct property but
|
|
8
|
-
* rather completes the `css` property with additional info.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { getGeneratedIDLNamesByCSSProperty } from '../lib/util.js';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
dependsOn: ['css', 'dfns'],
|
|
15
|
-
input: 'spec',
|
|
16
|
-
|
|
17
|
-
run: async function(spec, options) {
|
|
18
|
-
if (spec.dfns && spec.css) {
|
|
19
|
-
spec.dfns
|
|
20
|
-
.filter(dfn => dfn.type == "property" && !dfn.informative)
|
|
21
|
-
.forEach(propDfn => {
|
|
22
|
-
propDfn.linkingText.forEach(lt => {
|
|
23
|
-
if (!spec.css.properties.find(p => p.name === lt)) {
|
|
24
|
-
spec.css.properties.push({
|
|
25
|
-
name: lt,
|
|
26
|
-
href: propDfn.href
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (spec.css) {
|
|
34
|
-
// Add generated IDL attribute names
|
|
35
|
-
spec.css.properties.forEach(dfn => {
|
|
36
|
-
dfn.styleDeclaration = getGeneratedIDLNamesByCSSProperty(dfn.name);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Drop the sample definition (property-name) in CSS2 and the custom
|
|
40
|
-
// property definition (--*) in CSS Variables that specs incorrectly flag
|
|
41
|
-
// as real CSS properties.
|
|
42
|
-
spec.css.properties = spec.css.properties.filter(p =>
|
|
43
|
-
!['property-name', '--*'].includes(p.name));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return spec;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Post-processing module that adds CSS property definitions found in prose
|
|
3
|
+
* from the dfns extract, clean up property definitions that should never have
|
|
4
|
+
* been extracted, and adds the generated IDL attribute names in a
|
|
5
|
+
* styleDeclaration sub-property.
|
|
6
|
+
*
|
|
7
|
+
* Module runs at the spec level. It does not create a distinct property but
|
|
8
|
+
* rather completes the `css` property with additional info.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { getGeneratedIDLNamesByCSSProperty } from '../lib/util.js';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
dependsOn: ['css', 'dfns'],
|
|
15
|
+
input: 'spec',
|
|
16
|
+
|
|
17
|
+
run: async function(spec, options) {
|
|
18
|
+
if (spec.dfns && spec.css) {
|
|
19
|
+
spec.dfns
|
|
20
|
+
.filter(dfn => dfn.type == "property" && !dfn.informative)
|
|
21
|
+
.forEach(propDfn => {
|
|
22
|
+
propDfn.linkingText.forEach(lt => {
|
|
23
|
+
if (!spec.css.properties.find(p => p.name === lt)) {
|
|
24
|
+
spec.css.properties.push({
|
|
25
|
+
name: lt,
|
|
26
|
+
href: propDfn.href
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (spec.css) {
|
|
34
|
+
// Add generated IDL attribute names
|
|
35
|
+
spec.css.properties.forEach(dfn => {
|
|
36
|
+
dfn.styleDeclaration = getGeneratedIDLNamesByCSSProperty(dfn.name);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Drop the sample definition (property-name) in CSS2 and the custom
|
|
40
|
+
// property definition (--*) in CSS Variables that specs incorrectly flag
|
|
41
|
+
// as real CSS properties.
|
|
42
|
+
spec.css.properties = spec.css.properties.filter(p =>
|
|
43
|
+
!['property-name', '--*'].includes(p.name));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return spec;
|
|
47
|
+
}
|
|
48
|
+
};
|