Skip to content

Commit 9b00cff

Browse files
committed
Reorganize errata by publication date, and auto-generate TOC
1 parent 58b0486 commit 9b00cff

File tree

3 files changed

+88
-42
lines changed

3 files changed

+88
-42
lines changed

11ty/CustomLiquid.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,36 @@ export class CustomLiquid extends Liquid {
9292
super(options);
9393
this.termsMap = options.termsMap;
9494
}
95+
96+
private renderErrata(html: string) {
97+
const $ = load(html);
98+
99+
const $tocList = $("#contents .toc");
100+
let $childList: CheerioAnyNode | null = null;
101+
$("main section[id]:has(h2:first-child, h3:first-child)").each((_, el) => {
102+
const $el = $(el);
103+
// Only one of the following queries will match for each section
104+
$el.find("> h2:first-child").each((_, h2El) => {
105+
$childList = null;
106+
$tocList.append(`<li><a href="#${el.attribs.id}">${$(h2El).text()}</a></li>`);
107+
});
108+
$el.find("> h3:first-child").each((_, h3El) => {
109+
if (!$childList) $childList = $(`<ol class="toc"></ol>`).appendTo($tocList);
110+
$childList.append(`<li><a href="#${el.attribs.id}">${$(h3El).text()}</a></li>`);
111+
});
112+
});
113+
114+
return $.html();
115+
}
116+
95117
public parse(html: string, filepath?: string) {
96118
// Filter out Liquid calls for computed data and includes themselves
97-
if (filepath && !filepath.includes("_includes/") && isHtmlFileContent(html)) {
119+
if (
120+
filepath &&
121+
!filepath.includes("_includes/") &&
122+
!filepath.includes("errata/") &&
123+
isHtmlFileContent(html)
124+
) {
98125
const isIndex = indexPattern.test(filepath);
99126
const isTechniques = techniquesPattern.test(filepath);
100127
const isUnderstanding = understandingPattern.test(filepath);
@@ -309,6 +336,7 @@ export class CustomLiquid extends Liquid {
309336
// html contains markup after Liquid tags/includes have been processed
310337
const html = (await super.render(templates, scope, options)).toString();
311338
if (!isHtmlFileContent(html) || !scope || scope.page.url === false) return html;
339+
if (scope.page.inputPath.includes("errata/")) return this.renderErrata(html);
312340

313341
const $ = load(html);
314342

errata/21.html

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,66 @@ <h1 id="title">Web Content Accessibility Guidelines (WCAG) 2.1 Errata</h1>
1616
<section id="abstract">
1717
<h2>Abstract</h2>
1818
<p>This document records all known errors in the <a href="https://www.w3.org/TR/WCAG21/">Web Content Accessibility Guidelines (WCAG) 2.1</a> specification.</p>
19-
<p>The errata are numbered, classified as <a href="#substantive">Substantive</a> or <a href="#editorial">Editorial</a>, and listed in reverse chronological order of their date of publication in each category. </p>
19+
<p>The errata are classified as Substantive or Editorial, and listed in chronological order based on the date of publication to which they are applicable.</p>
2020
<p>Each entry has the following information:</p>
2121
<ul>
22-
<li>A unique entry number</li>
23-
<li>The date it was added to the errata page.</li>
2422
<li>The section referred to.</li>
2523
<li>A description of the problem and correction if applicable.</li>
2624
<li>A rationale for making the change (not required for editorial errata).</li>
2725
</ul>
2826
<p>Substantive corrections are proposed by the <a href="https://www.w3.org/WAI/GL/">Accessibility Guidelines Working Group</a>, which has consensus that they are appropriate; they are not to be considered normative until a new Recommendation is published following the <a href="https://www.w3.org/2018/Process-20180201/#revised-rec">process to revise a Recommendation</a>.</p>
29-
<p>Please view the <a href="/WAI/standards-guidelines/wcag/commenting/">public comment instructions</a> if you would like to comment to the Working Group. Comments submitted are publicly available in the <a href="http://lists.w3.org/Archives/Public/public-agwg-comments/">archive for the Accessibility Guidelines Working Group public comments mailing list</a>.</p>
27+
<p>Please view the <a href="https://www.w3.org/WAI/standards-guidelines/wcag/commenting/">public comment instructions</a> if you would like to comment to the Working Group. Comments submitted are publicly available in the <a href="http://lists.w3.org/Archives/Public/public-agwg-comments/">archive for the Accessibility Guidelines Working Group public comments mailing list</a>.</p>
3028
</section>
3129
<section id="contents">
3230
<h2>Table of Contents</h2>
3331
<ol class="toc">
34-
<li><a href="#substantive">Substantive Errata</a></li>
35-
<li><a href="#editorial">Editorial Errata</a></li>
32+
{%- # Leave this empty - populated during the build process -%}
3633
</ol>
3734
</section>
3835
<hr/>
3936
<main>
40-
<section id="substantive">
41-
<h2>Substantive Errata</h2>
42-
<p>No substantive errata have been recorded at present.</p>
37+
{%- assign trDate = "2018-06-05" -%}
38+
{%- capture trUrl -%}https://www.w3.org/TR/2018/REC-WCAG21-{{ trDate | replace: "-", "" }}/{%- endcapture -%}
39+
<section id="since-{{ trDate }}">
40+
<h2>Errata since <a href="{{ trUrl }}">{{ trDate | date: "%d %B %Y" }} Publication</a></h2>
41+
<section id="substantive-{{ trDate }}">
42+
<h3>Substantive Errata</h3>
43+
<p>No substantive errata have been recorded at present.</p>
44+
</section>
45+
<section id="editorial-{{ trDate }}">
46+
<h3>Editorial Errata</h3>
47+
<ul>
48+
<li>In the <a href="{{ trUrl }}#sotd">Status of This Document</a> the paragraph beginning "This document has been reviewed by W3C Members..." appears twice. The first instance of this paragraph should be removed.</li>
49+
<li>In the <a href="{{ trUrl }}#intro">Introduction</a>, several (but not all) references to "WCAG 2.0" should be "WCAG 2.1".</li>
50+
<li>In the <a href="{{ trUrl }}#numbering-in-wcag-2-1">0.5.2 Numbering in WCAG 2.1</a>, the words "critera" and "ccriteria" should be "criteria".</li>
51+
<li>In <a href="{{ trUrl }}#reflow">1.4.10 Reflow</a>, the first note had a supernumary "Note" indicator which should be removed.</li>
52+
<li>In <a href="{{ trUrl }}#content-on-hover-or-focus">1.4.13 Content on Hover or Focus</a>, the word "dismissable" should be "dismissible".</li>
53+
<li>In <a href="{{ trUrl }}#robust">4. Robust</a>, the word "by" is repeated but should be present only once.</li>
54+
<li>In <a href="{{ trUrl }}#cc2">5.2.2 Full pages</a>, the third note began with "New" which should be removed.</li>
55+
<li>In <a href="{{ trUrl }}#conformance-required">5.3.1 Required Components of a Conformance Claim</a> the editorial note "In WCAG 2.0 this was a dated URI, which may need to be adjusted when this becomes a Rec." should be removed.</li>
56+
<li>In the definition for <a href="{{ trUrl }}#dfn-keyboard-interface">keyboard interface</a>, the second (of three) note should be an example of the first note, leaving only two actual notes.</li>
57+
<li>In the definition for <a href="{{ trUrl }}#dfn-technologies">technology</a>, the third note should instead be an example.</li>
58+
<li>In <a href="{{ trUrl }}#input-purposes">7. Input Purposes for User Interface Components</a>, the word "county" should be "country".</li>
59+
<li>In <a href="{{ trUrl }}#orientation">1.3.4 Orientation</a>, the note referencing "binary display orientation" has been clarified to read "content is not necessarily restricted to landscape or portrait display orientation".</li>
60+
<li>In <a href="{{ trUrl }}#issue-container-generatedID-43">a note in the definition of accessibility supported</a>, references to "Conformance Criterion" were changed to "Conformance Requirement".</li>
61+
<li>In the <a href="{{ trUrl }}#dfn-relative-luminance">definition of relative luminance</a>, the red threshold was updated from 0.03928 to 0.04045.</li>
62+
<li>In <a href="{{ trUrl }}#parsing">4.1.1 Parsing</a> one note should be deleted, and two notes added, including: "This Success Criterion should be considered as always satisfied for any content using HTML or XML."</li>
63+
</ul>
64+
</section>
4365
</section>
44-
<section id="editorial">
45-
<h2>Editorial Errata</h2>
46-
<ul>
47-
<li>In the <a href="https://www.w3.org/TR/WCAG21/#sotd">Status of This Document</a> the paragraph beginning "This document has been reviewed by W3C Members..." appears twice. The first instance of this paragraph should be removed.</li>
48-
<li>In the <a href="https://www.w3.org/TR/WCAG21/#intro">Introduction</a>, several (but not all) references to "WCAG 2.0" should be "WCAG 2.1".</li>
49-
<li>In the <a href="https://www.w3.org/TR/WCAG21/#numbering-in-wcag-2-1">0.5.2 Numbering in WCAG 2.1</a>, the words "critera" and "ccriteria" should be "criteria".</li>
50-
<li>In <a href="https://www.w3.org/TR/WCAG21/#reflow">1.4.10 Reflow</a>, the first note had a supernumary "Note" indicator which should be removed.</li>
51-
<li>In <a href="https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus">1.4.13 Content on Hover or Focus</a>, the word "dismissable" should be "dismissible".</li>
52-
<li>In <a href="https://www.w3.org/TR/WCAG21/#robust">4. Robust</a>, the word "by" is repeated but should be present only once.</li>
53-
<li>In <a href="https://www.w3.org/TR/WCAG21/#cc2">5.2.2 Full pages</a>, the third note began with "New" which should be removed.</li>
54-
<li>In <a href="https://www.w3.org/TR/WCAG21/#conformance-required">5.3.1 Required Components of a Conformance Claim</a> the editorial note "In WCAG 2.0 this was a dated URI, which may need to be adjusted when this becomes a Rec." should be removed.</li>
55-
<li>In the definition for <a href="https://www.w3.org/TR/WCAG21/#dfn-keyboard-interface">keyboard interface</a>, the second (of three) note should be an example of the first note, leaving only two actual notes.</li>
56-
<li>In the definition for <a href="https://www.w3.org/TR/WCAG21/#dfn-technologies">technology</a>, the third note should instead be an example.</li>
57-
<li>In <a href="https://www.w3.org/TR/WCAG21/#input-purposes">7. Input Purposes for User Interface Components</a>, the word "county" should be "country".</li>
58-
<li>In <a href="https://www.w3.org/TR/WCAG21/#orientation">1.3.4 Orientation</a>, the note referencing "binary display orientation" has been clarified to read "content is not necessarily restricted to landscape or portrait display orientation".</li>
59-
<li>In <a href="https://www.w3.org/TR/WCAG21/#issue-container-generatedID-43">a note in the definition of accessibility supported</a>, references to "Conformance Criterion" were changed to "Conformance Requirement".</li>
60-
<li>In the <a href="https://www.w3.org/TR/WCAG21/#dfn-relative-luminance">definition of relative luminance</a>, the red threshold was updated from 0.03928 to 0.04045.</li>
61-
<li>In <a href="https://www.w3.org/TR/WCAG21/#parsing">4.1.1 Parsing</a> one note should be deleted, and two notes added, including: "This Success Criterion should be considered as always satisfied for any content using HTML or XML."</li>
62-
</ul>
66+
67+
{%- assign trDate = "current" -%}
68+
{%- assign trUrl = "https://www.w3.org/TR/WCAG21/" -%}
69+
<section id="since-{{ trDate }}">
70+
<h2>Errata since <a href="{{ trUrl }}">Current Publication</a></h2>
71+
<section id="substantive-{{ trDate }}">
72+
<h3>Substantive Errata</h3>
73+
<p>No substantive errata have been recorded at present.</p>
74+
</section>
75+
<section id="editorial-{{ trDate }}">
76+
<h3>Editorial Errata</h3>
77+
<p>No editorial errata have been recorded at present.</p>
78+
</section>
6379
</section>
6480
</main>
6581
</body>

errata/22.html

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,37 @@ <h1 id="title">Web Content Accessibility Guidelines (WCAG) 2.2 Errata</h1>
1616
<section id="abstract">
1717
<h2>Abstract</h2>
1818
<p>This document records all known errors in the <a href="https://www.w3.org/TR/WCAG22/">Web Content Accessibility Guidelines (WCAG) 2.2</a> specification.</p>
19-
<p>The errata are numbered, classified as <a href="#substantive">Substantive</a> or <a href="#editorial">Editorial</a>, and listed in reverse chronological order of their date of publication in each category. </p>
19+
<p>The errata are classified as Substantive or Editorial, and listed in chronological order based on the date of publication to which they are applicable.</p>
2020
<p>Each entry has the following information:</p>
2121
<ul>
22-
<li>A unique entry number</li>
23-
<li>The date it was added to the errata page.</li>
2422
<li>The section referred to.</li>
2523
<li>A description of the problem and correction if applicable.</li>
2624
<li>A rationale for making the change (not required for editorial errata).</li>
2725
</ul>
2826
<p>Substantive corrections are proposed by the <a href="https://www.w3.org/WAI/GL/">Accessibility Guidelines Working Group</a>, which has consensus that they are appropriate; they are not to be considered normative until a new Recommendation is published following the <a href="https://www.w3.org/2018/Process-20180201/#revised-rec">process to revise a Recommendation</a>.</p>
29-
<p>Please view the <a href="/WAI/standards-guidelines/wcag/commenting/">public comment instructions</a> if you would like to comment to the Working Group. Comments submitted are publicly available in the <a href="http://lists.w3.org/Archives/Public/public-agwg-comments/">archive for the Accessibility Guidelines Working Group public comments mailing list</a>.</p>
27+
<p>Please view the <a href="https://www.w3.org/WAI/standards-guidelines/wcag/commenting/">public comment instructions</a> if you would like to comment to the Working Group. Comments submitted are publicly available in the <a href="http://lists.w3.org/Archives/Public/public-agwg-comments/">archive for the Accessibility Guidelines Working Group public comments mailing list</a>.</p>
3028
</section>
3129
<section id="contents">
3230
<h2>Table of Contents</h2>
3331
<ol class="toc">
34-
<li><a href="#substantive">Substantive Errata</a></li>
35-
<li><a href="#editorial">Editorial Errata</a></li>
32+
{%- # Leave this empty - populated during the build process -%}
3633
</ol>
3734
</section>
3835
<hr />
3936
<main>
40-
<section id="substantive">
41-
<h2>Substantive Errata</h2>
42-
<p>No substantive errata recorded at present.</p>
37+
{%- assign trDate = "current" -%}
38+
{%- assign trUrl = "https://www.w3.org/TR/WCAG22/" -%}
39+
<section id="since-{{ trDate }}">
40+
<h2>Errata since <a href="{{ trUrl }}">Current Publication</a></h2>
41+
<section id="substantive-{{ trDate }}">
42+
<h3>Substantive Errata</h3>
43+
<p>No substantive errata recorded at present.</p>
44+
</section>
45+
<section id="editorial-{{ trDate }}">
46+
<h3>Editorial Errata</h3>
47+
<p>No editorial errata recorded at present.</p>
48+
</section>
4349
</section>
44-
<section id="editorial">
45-
<h2>Editorial Errata</h2>
46-
</section>
47-
<p>No editorial errata recorded at present.</p>
4850
</main>
4951
</body>
5052
</html>

0 commit comments

Comments
 (0)