Skip to content

Commit c87161d

Browse files
committed
Add missing meta charset and remove editors stylesheet at build time
1 parent 675a92f commit c87161d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

11ty/CustomLiquid.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ 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,
141+
// Note 1: some paragraphs with the "instructions" class actually have custom content,
142142
// but for now this remains consistent with the XSLT process by stripping all of them.
143-
$(".remove, section#meta, section.meta").remove();
143+
// Note 2: the link selector accounts for ~40 files forgetting class="remove" on editors.css
144+
$(".remove, link[href$='editors.css'], section#meta, section.meta").remove();
144145

145146
if ($("p.instructions").length > 0) {
146147
console.error(`${filepath} contains a <p class="instructions"> element.\n` +
@@ -151,6 +152,9 @@ export class CustomLiquid extends Liquid {
151152
throw new Error("Instructions paragraph found; please resolve.")
152153
}
153154

155+
// Add charset to pages that forgot it
156+
if (!$("meta[charset]").length) $('<meta charset="UTF-8">').prependTo("head");
157+
154158
const prependedIncludes = ["header"];
155159
const appendedIncludes = ["wai-site-footer", "site-footer"];
156160

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)