Skip to content

Commit

Permalink
Dfns extraction: hardcode exception for "prefixed syntax"
Browse files Browse the repository at this point in the history
Fixes w3c/webref#882 pending a more proper dfns
curation process as envisioned in w3c/webref#789
  • Loading branch information
tidoust committed Feb 21, 2023
1 parent 1e296a5 commit 9bbea57
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/browserlib/extract-dfns.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions tests/extract-dfns.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,22 @@ When initialize(<var>newItem</var>) is called, the following steps are run:</p>`
definedIn: "pre"
}],
spec :"SVG2",
},

{
title: "includes a dfn that links to CSS2 Vendor-specific extensions section (hardcoded rule)",
html: `<p>The CSS2.1 specification reserves a
<dfn data-dfn-type="dfn" data-export="" id="prefixed-syntax">
<a href="https://www.w3.org/TR/CSS2/syndata.html#vendor-keywords">prefixed syntax</a>
</dfn>.</p>
`,
changesToBaseDfn: [{
id: "prefixed-syntax",
linkingText: ["prefixed syntax"],
type: "dfn",
access: "public",
definedIn: "prose"
}]
}
];

Expand Down

0 comments on commit 9bbea57

Please sign in to comment.