reffy 18.7.0 → 18.7.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": "18.7.0",
3
+ "version": "18.7.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",
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "respec": "35.4.0",
47
47
  "respec-hljs": "2.1.1",
48
- "rollup": "4.41.0",
48
+ "rollup": "4.41.1",
49
49
  "undici": "^7.0.0"
50
50
  },
51
51
  "overrides": {
@@ -60,7 +60,8 @@
60
60
  "id": { "$ref": "../common.json#/$defs/id" },
61
61
  "href": { "$ref": "../common.json#/$defs/url" },
62
62
  "title": { "type": "string" },
63
- "number": { "$ref": "../common.json#/$defs/headingNumber" }
63
+ "number": { "$ref": "../common.json#/$defs/headingNumber" },
64
+ "alternateIds": { "type": "array", "items": { "$ref": "../common.json#/$defs/id"} }
64
65
  }
65
66
  },
66
67
  "definedIn": {
@@ -199,6 +199,24 @@ function definitionMapper(el, idToHeading, usesDfnDataModel) {
199
199
  break;
200
200
  }
201
201
 
202
+ // Linking text is given by the data-lt attribute if present, or it is the
203
+ // textual content... but we'll skip section numbers that might have been
204
+ // captured when definition is defined in a heading, as in:
205
+ // https://www.w3.org/TR/ethical-web-principles/#oneweb
206
+ let linkingText = [];
207
+ if (el.hasAttribute('data-lt')) {
208
+ linkingText = el.getAttribute('data-lt').split('|').map(normalize);
209
+ }
210
+ else if (el.querySelector('.secno')) {
211
+ const copy = el.cloneNode(true);
212
+ const secno = copy.querySelector('.secno');
213
+ secno.remove();
214
+ linkingText = [normalize(copy.textContent)];
215
+ }
216
+ else {
217
+ linkingText = [normalize(el.textContent)];
218
+ }
219
+
202
220
  // Compute the absolute URL with fragment
203
221
  // (Note the crawler merges pages of a multi-page spec in the first page
204
222
  // to ease parsing logic, and we want to get back to the URL of the page)
@@ -215,11 +233,8 @@ function definitionMapper(el, idToHeading, usesDfnDataModel) {
215
233
  // Absolute URL with fragment
216
234
  href,
217
235
 
218
- // Linking text is given by the data-lt attribute if present, or it is the
219
- // textual content
220
- linkingText: el.hasAttribute('data-lt') ?
221
- el.getAttribute('data-lt').split('|').map(normalize) :
222
- [normalize(el.textContent)],
236
+ // Linking text
237
+ linkingText,
223
238
 
224
239
  // Additional linking text can be defined for local references
225
240
  localLinkingText: el.getAttribute('data-local-lt') ?