Skip to content

Commit 6b54c4d

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

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,13 @@ 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();
145+
146+
// Add <meta charset="UTF-8"> to pages that forgot it
147+
if (!$("meta[charset]").length) $('<meta charset="UTF-8">').prependTo("head");
144148

145149
if ($("p.instructions").length > 0) {
146150
console.error(`${filepath} contains a <p class="instructions"> element.\n` +

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)