From 97741c65419aa9e0e55b7d2307031d4d3ff15978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Daoust?= Date: Tue, 21 Feb 2023 12:55:06 +0100 Subject: [PATCH] Dfns extraction: hardcode exception for "prefixed syntax" (#1212) Fixes https://github.com/w3c/webref/issues/882 pending a more proper dfns curation process as envisioned in https://github.com/w3c/webref/issues/789 --- src/browserlib/extract-dfns.mjs | 8 +++++++- tests/extract-dfns.js | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/browserlib/extract-dfns.mjs b/src/browserlib/extract-dfns.mjs index b2b0ef7e..7236f856 100644 --- a/src/browserlib/extract-dfns.mjs +++ b/src/browserlib/extract-dfns.mjs @@ -265,9 +265,15 @@ export default function (spec, idToHeading = {}) { // When the whole term links to an external spec, the definition is an // imported definition. Such definitions are not "real" definitions, let's // skip them. + // One hardcoded exception-to-the-rule, see: + // https://github.com/w3c/webref/issues/882 + // (pending a proper dfns curation process, see: + // https://github.com/w3c/webref/issues/789) .filter(node => { const link = node.querySelector('a[href^="http"]'); - return !link || (node.textContent.trim() !== link.textContent.trim()); + return !link || + (node.textContent.trim() !== link.textContent.trim()) || + (link.href === 'https://www.w3.org/TR/CSS2/syndata.html#vendor-keywords'); }) .map(node => definitionMapper(node, idToHeading, usesDfnDataModel)) .filter(isNotAlreadyExported); diff --git a/tests/extract-dfns.js b/tests/extract-dfns.js index 86383829..717573d9 100644 --- a/tests/extract-dfns.js +++ b/tests/extract-dfns.js @@ -428,6 +428,22 @@ When initialize(newItem) is called, the following steps are run:

` definedIn: "pre" }], spec :"SVG2", + }, + + { + title: "includes a dfn that links to CSS2 Vendor-specific extensions section (hardcoded rule)", + html: `

The CSS2.1 specification reserves a + + prefixed syntax + .

+ `, + changesToBaseDfn: [{ + id: "prefixed-syntax", + linkingText: ["prefixed syntax"], + type: "dfn", + access: "public", + definedIn: "prose" + }] } ];