Skip to content

Commit d3385ba

Browse files
authored
Pin guidelines/* content when publishing 2.2 docs to w3.org (#4161)
This applies the same publication-version-pinning logic added in #4007 for 2.1 docs, to 2.2 docs specifically when built for w3.org, so that guideline/SC and definition text included within informative docs matches the published recommendation. Local dev and gh-pages builds continue to run against `guidelines` in the local repository (effectively the Editor's Draft). The build uses the published recommendation whenever `WCAG_VERSION` is specified, so enabling this for w3.org builds only requires adding that environment variable explicitly to the `publish-w3c` script. The changes to `11ty/guidelines.ts` fix cases that were never exhibited in the 2.1 build, but came up when testing building 2.2 against the published recommendation.
1 parent 9015d93 commit d3385ba

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

11ty/guidelines.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ const loadRemoteGuidelines = async (version: WcagVersion) => {
247247
$("[role='note'] .marker").remove();
248248
$("[role='note']").find("> div, > p").addClass("note").unwrap();
249249

250+
// Convert data-plurals (present in publications) to data-lt
251+
$("dfn[data-plurals]").each((_, el) => {
252+
el.attribs["data-lt"] = (el.attribs["data-lt"] || "")
253+
.split("|")
254+
.concat(el.attribs["data-plurals"].split("|"))
255+
.join("|");
256+
delete el.attribs["data-plurals"];
257+
});
258+
250259
// Un-process bibliography references, to be processed by CustomLiquid
251260
$("cite:has(a.bibref:only-child)").each((_, el) => {
252261
const $el = $(el);
@@ -255,7 +264,7 @@ const loadRemoteGuidelines = async (version: WcagVersion) => {
255264

256265
// Remove generated IDs and markers from examples
257266
$(".example[id]").removeAttr("id");
258-
$(".example .marker:has(.self-link)").remove();
267+
$(".example > .marker").remove();
259268

260269
// Remove extra markup from headings so they can be parsed for names
261270
$("bdi").remove();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "tsx node_modules/@11ty/eleventy/cmd.cjs --config=eleventy.config.ts",
99
"check": "tsc",
1010
"fmt": "prettier . -w",
11-
"publish-w3c": "WCAG_MODE=publication npm run build && tsx 11ty/cp-cvs.ts",
11+
"publish-w3c": "WCAG_VERSION=22 WCAG_MODE=publication npm run build && tsx 11ty/cp-cvs.ts",
1212
"publish-w3c:21": "WCAG_VERSION=21 WCAG_MODE=publication npm run build && WCAG_VERSION=21 tsx 11ty/cp-cvs.ts",
1313
"start": "tsx watch node_modules/@11ty/eleventy/cmd.cjs --config=eleventy.config.ts --serve --incremental"
1414
},

0 commit comments

Comments
 (0)