-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Eleventy-based build system #3917
Conversation
The XSLT process has a bunch of special cases for generating table of contents, but upon inspection I suspect they are unnecessary; I'm initially trying a much simpler approach that can apply equally to both Techniques and Understanding. ToC is not 100% correct in the new process yet due to headings not yet being reordered the way they are in the previous process.
Also: - Preparation for processing box at top of both techniques and understanding (techniques box uses same data as applicability) - Make 11tydata fully static, moving all eleventyComputed data to eleventy.config.ts so we have access to typings
Also take this opportunity to set jsTruthy to true in liquid config, which is generally more convenient / less surprising
kfranqueiro marked as non substantive for IPR from ash-nazg. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Ken!
I really appreciate having you on the project and the clear communications as much as your technical expertise. I will not be attempting my own local build, so I am picking "comment" rather than "approve" for this review.
This replaces the existing files under `.github` (both `workflows` and `scripts`) with a new workflow using the Eleventy build process. - Current behavior RE `conformance-challenges`, `guidelines`, and `requirements` directories is retained - Also ensures necessary CSS is updated under `guidelines` - `techniques`, `understanding`, and `working-examples` are now generated by the Eleventy build process This has positive side effects over what's currently seen on github.io: - Fixes broken styles - Updates any auto-generated cross-links to guidelines to point to 2.2 editor's draft instead of 2.1 - All of the fixes mentioned in #3917
My first project for W3C has been to develop a replacement for the Ant/XSLT-based build system, to give us something that is more flexible to modify and hopefully easier to maintain, since XSLT can be very hard to follow and is not something many people are well-versed in.
The primary building blocks of this PR are Eleventy, as a basis for static site generation and includes, and Cheerio, for in-place markup modifications to take the place of much of what the XSLT was doing in the old build system. TypeScript is also used, as there is a significant amount of custom logic that warrants typings to be easier to work with.
In addition to being able to test this locally (see below), you can now also see the output deployed at:
(A new github action is on a separate branch for after this PR.)
Goals
The primary goal of the new build system is to replicate the
techniques
andunderstanding
output of the existing process as closely as possible to give us a starting point for further improvements. However, there are a couple of noticeable changes and many fixes, noted below.An additional goal is to avoid the need to touch any input files at this point, given the large number of existing open PRs.
Expected benefits include easier local previewing, and no longer having to worry about HTML doubling as valid XML in order to build successfully.
Files in this PR
_includes
directory: contains as much markup as is feasible to isolate for reusable pieces of pagesinclude
directives currently exist within a Liquid extension class where in-place transformations are performed, in order to avoid modifying source files11ty
directory: contains all customizations and data retrieval for the Eleventy build*.11tydata.json
file is added to each of thetechniques
andunderstanding
directories with common data used for processing files in each directoryHow to test-run this locally
git remote add kgf https://github.com/kfranqueiro/wcag.git
git checkout kgf-11ty
There is a README file in the
11ty
directory that explains setup and available commands. The short version is:npm i
npm start
localhost:8080/techniques
or/understanding
I suggest Node 20 (LTS) in the README, but I've now performed test-runs on Node 18, 20, and 22; any of these should work.
Significant changes in this PR
I discussed these changes with @alastc, @mbgower, and @bruce-usab during the weeks leading up to this PR.
About this Technique and Applicability merged
These two sections within individual technique pages were partially redundant of each other. Rather than have to implement 2 sets of wording logic for the same data, this PR incorporates the bulleted-list version of related SC into the About box, followed by any prose originally appearing at the top of the applicability section.
This eliminates various punctuation issues currently observed in the About this Technique box.
"Other sources" h3 replaced with "Related Resources" h2
Techniques pages often have a top-level
resources
section, which has typically been coded as anh2
in the source files. For some reason, as of #2874, this is transformed into anh3
in the XSLT process, even though it is still a top-level section, still appears in the table of contents (which otherwise only reflects level-2 headings), and the same section remains anh2
for Understanding pages. Furthermore, due to varying content between files, what it ultimately becomes a "subheading" of is not consistent (it is typically after/under Examples, but in at least one instance, there are none, so it is after/under Description). Even if it consistently appeared under Examples, the links in this section are not always related to examples.This was simpler to revert back to the original h2 behavior, as part of the process of ensuring that consistently-recurring sections and headings are at the correct level, and ensuring that the table of contents is consistently constructed from
h2
s in every document.Fixes in this PR
I inevitably found and fixed some behaviors during this effort (sometimes because they were easier to fix than to reproduce as-is).
dl
<a>
tagnote
class is used in both)h2
elements (after operations to ensure those are consistent)id=""
attribute valuespointer-accessible
special case for guidelines version data corrected toinput-modalities
h3
s within top-level sections (e.g. Intent subheadings in Understanding pages, and examples headings not nested in a sub-section e.g. Textarea in H91)How I've tested this PR
I have performed multiple rounds of checks on this PR:
cp-cvs
script by modifying it to run against the Ant/XSLT-producedoutput
directory and comparing the changes/output betweenant publish-w3c
(the old copy task) andnpm run publish-w3c
(the new one)