Skip to content

Commit 69088aa

Browse files
kfranqueiropatrickhlaukembgower
authored
Add missing meta charset and remove editors stylesheet at build time (#4513)
Fixes #4505. This is an alternative to #4506 that resolves the same issues without changing source files, to avoid potential conflicts with other open PRs. I diffed the build before and after this PR, and it results in effectively the same output as #4506, plus also catches a few instances under `understanding`. I did update the technique and understanding template files, to try to avoid the same mistakes happening on future additions. --------- Co-authored-by: Patrick H. Lauke <[email protected]> Co-authored-by: Mike Gower <[email protected]>
1 parent 293af1b commit 69088aa

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

11ty/CustomLiquid.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ export class CustomLiquid extends Liquid {
138138

139139
// Clean out elements to be removed
140140
// (e.g. editors.css & sources.css, and leftover template paragraphs)
141-
// NOTE: some paragraphs with the "instructions" class actually have custom content,
142-
// but for now this remains consistent with the XSLT process by stripping all of them.
143-
$(".remove, section#meta, section.meta").remove();
141+
// Note: the link selector accounts for ~40 files forgetting class="remove" on editors.css
142+
$(".remove, link[href$='editors.css'], section#meta, section.meta").remove();
144143

145144
if ($("p.instructions").length > 0) {
146145
console.error(`${filepath} contains a <p class="instructions"> element.\n` +
@@ -151,6 +150,9 @@ export class CustomLiquid extends Liquid {
151150
throw new Error("Instructions paragraph found; please resolve.")
152151
}
153152

153+
// Add charset to pages that forgot it
154+
if (!$("meta[charset]").length) $('<meta charset="UTF-8">').prependTo("head");
155+
154156
const prependedIncludes = ["header"];
155157
const appendedIncludes = ["wai-site-footer", "site-footer"];
156158

techniques/technique-template.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4+
<meta charset="UTF-8">
45
<title>Technique Title</title>
5-
<link rel="stylesheet" type="text/css" href="../../css/editors.css">
6+
<link rel="stylesheet" type="text/css" href="../../css/editors.css" class="remove">
67
</head>
78
<body>
89
<h1>Technique Title</h1>

understanding/understanding-template.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4+
<meta charset="UTF-8">
45
<title>WCAG 2 Understanding Page</title>
5-
<link rel="stylesheet" type="text/css" href="sources.css">
6+
<link rel="stylesheet" type="text/css" href="sources.css" class="remove">
67
</head>
78
<body>
89
<h1>Understanding SC #.#.#</h1>

0 commit comments

Comments
 (0)