From eb067859b56625597549c80f443dfddc3c55ce51 Mon Sep 17 00:00:00 2001 From: "Kenneth G. Franqueiro" Date: Mon, 7 Oct 2024 12:48:07 -0400 Subject: [PATCH] Revert "2.1 support: Pin ACT mappings to requested version" This reverts commit 89e759363bd0c26c26a0754f3a3c472564a4d9bd. 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. --- 11ty/guidelines.ts | 19 +++++-------------- eleventy.config.ts | 7 +------ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/11ty/guidelines.ts b/11ty/guidelines.ts index 7eb46f29dd..e033c0964e 100644 --- a/11ty/guidelines.ts +++ b/11ty/guidelines.ts @@ -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 { @@ -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. @@ -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( - `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. */ diff --git a/eleventy.config.ts b/eleventy.config.ts index dd313feec8..529bee8e0c 100644 --- a/eleventy.config.ts +++ b/eleventy.config.ts @@ -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, @@ -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) */