Skip to content

Commit

Permalink
Revert "2.1 support: Pin ACT mappings to requested version"
Browse files Browse the repository at this point in the history
This reverts commit 89e7593.

After discussion with Daniel who conferred with ACT planning team,
the version of act-mapping.json currently on the WCAG-2.1 branch
is indeed very out of date and not something to preserve.
  • Loading branch information
kfranqueiro committed Oct 7, 2024
1 parent b645c53 commit eb06785
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
19 changes: 5 additions & 14 deletions 11ty/guidelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { readFile } from "fs/promises";
import { basename } from "path";

import { flattenDomFromFile, load } from "./cheerio";
import { generateId, resolveDecimalVersion } from "./common";
import { generateId } from "./common";

export type WcagVersion = "20" | "21" | "22";
export function assertIsWcagVersion(v: string): asserts v is WcagVersion {
Expand All @@ -29,9 +29,10 @@ type ActMapping = {
"act-rules": ActRule[];
};

/** Retrieves act-mapping.json data for test-rules sections. */
export const getActRules = async () =>
(JSON.parse(await readFile("guidelines/act-mapping.json", "utf8")) as ActMapping)["act-rules"];
/** Data used for test-rules sections, from act-mapping.json */
export const actRules = (
JSON.parse(await readFile("guidelines/act-mapping.json", "utf8")) as ActMapping
)["act-rules"];

/**
* Flattened object hash, mapping each WCAG 2 SC slug to the earliest WCAG version it applies to.
Expand Down Expand Up @@ -280,16 +281,6 @@ export const getAcknowledgementsForVersion = async (version: WcagVersion) => {
return subsections;
};

/**
* Retrieves act-mapping.json data for test-rules sections, pinned to an earlier WCAG version.
*/
export const getActRulesForVersion = async (version: WcagVersion) =>
(
await axios.get<ActMapping>(
`https://raw.githubusercontent.com/w3c/wcag/refs/heads/WCAG-${resolveDecimalVersion(version)}/guidelines/act-mapping.json`
)
).data["act-rules"];

/**
* Retrieves and processes a pinned WCAG version using published guidelines.
*/
Expand Down
7 changes: 1 addition & 6 deletions eleventy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { copyFile } from "fs/promises";
import { CustomLiquid } from "11ty/CustomLiquid";
import { resolveDecimalVersion } from "11ty/common";
import {
actRules,
assertIsWcagVersion,
getActRules,
getActRulesForVersion,
getFlatGuidelines,
getPrinciples,
getPrinciplesForVersion,
Expand Down Expand Up @@ -47,10 +46,6 @@ const isTechniqueObsolete = (technique: Technique | undefined) =>
const isGuidelineObsolete = (guideline: Principle | Guideline | SuccessCriterion | undefined) =>
guideline?.type === "SC" && guideline.level === "";

const actRules = process.env.WCAG_VERSION
? await getActRulesForVersion(version)
: await getActRules();

/** Tree of Principles/Guidelines/SC across all versions (including later than selected) */
const allPrinciples = await getPrinciples();
/** Flattened Principles/Guidelines/SC across all versions (including later than selected) */
Expand Down

0 comments on commit eb06785

Please sign in to comment.