Skip to content

Commit

Permalink
fix(xref/scraper): rename abstract-op to dfn (#207)
Browse files Browse the repository at this point in the history
allows searching for abstract-op terms by treating them same as dfn or _CONCEPT_
  • Loading branch information
sidvishnoi authored Jun 4, 2021
1 parent 705f3f6 commit 45afa77
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions routes/xref/lib/scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ function mapDefinition(
term: string,
spec: { spec: string; shortname: string; url: string; status: Status },
) {
const normalizedType = CSS_TYPES_INPUT.has(dfn.type)
? `css-${dfn.type}`
: dfn.type;
const normalizedType = normalizeType(dfn.type);
return {
term: normalizeTerm(term, normalizedType),
isExported: dfn.access === "public",
Expand Down Expand Up @@ -172,6 +170,12 @@ function updateDataBySpec(terms: ParsedDataEntry[], data: DataBySpec) {
}
}

function normalizeType(type: string) {
if (CSS_TYPES_INPUT.has(type)) return `css-${type}`;
if (type === "abstract-op") return "dfn";
return type;
}

function normalizeTerm(term: string, type: string) {
if (type === "enum-value") {
return term.replace(/^"|"$/g, "");
Expand Down

0 comments on commit 45afa77

Please sign in to comment.