Skip to content

Commit

Permalink
Pin guidelines/* content when publishing 2.2 docs to w3.org (#4161)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kfranqueiro authored Dec 19, 2024
1 parent 9015d93 commit d3385ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion 11ty/guidelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ const loadRemoteGuidelines = async (version: WcagVersion) => {
$("[role='note'] .marker").remove();
$("[role='note']").find("> div, > p").addClass("note").unwrap();

// Convert data-plurals (present in publications) to data-lt
$("dfn[data-plurals]").each((_, el) => {
el.attribs["data-lt"] = (el.attribs["data-lt"] || "")
.split("|")
.concat(el.attribs["data-plurals"].split("|"))
.join("|");
delete el.attribs["data-plurals"];
});

// Un-process bibliography references, to be processed by CustomLiquid
$("cite:has(a.bibref:only-child)").each((_, el) => {
const $el = $(el);
Expand All @@ -255,7 +264,7 @@ const loadRemoteGuidelines = async (version: WcagVersion) => {

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

// Remove extra markup from headings so they can be parsed for names
$("bdi").remove();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsx node_modules/@11ty/eleventy/cmd.cjs --config=eleventy.config.ts",
"check": "tsc",
"fmt": "prettier . -w",
"publish-w3c": "WCAG_MODE=publication npm run build && tsx 11ty/cp-cvs.ts",
"publish-w3c": "WCAG_VERSION=22 WCAG_MODE=publication npm run build && tsx 11ty/cp-cvs.ts",
"publish-w3c:21": "WCAG_VERSION=21 WCAG_MODE=publication npm run build && WCAG_VERSION=21 tsx 11ty/cp-cvs.ts",
"start": "tsx watch node_modules/@11ty/eleventy/cmd.cjs --config=eleventy.config.ts --serve --incremental"
},
Expand Down

0 comments on commit d3385ba

Please sign in to comment.