Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dfns extraction: hardcode exception for "prefixed syntax" #1212

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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