Repository navigation
Conversation
- CG-LIVING - CG-SNAPSHOT Include the cgbgStatus and new CG assets (base.css, cg-spec.css, dark.css, cg-fixup.js and cg-metadata.js) for these new profiles. Introduce <meta> tags required by the new profiles. Run some validation.
…ata + introduce new boilerplates depending on the type of CG specs
8585b0b to
a938dcf
Compare
…oscript>' parses its content as raw text
|
@sidvishnoi, do you mind reviewing this first if you have cycles. If you're busy, happy to dive in. |
| const COMMUNITY = "https://www.w3.org/community/"; | ||
| const INCUBATION = "https://incubation.w3.org/"; | ||
|
|
||
| const chevron = () => |
There was a problem hiding this comment.
this is only called once, so we can probably just inline it. Does this need any ARIA stuff?
| @@ -0,0 +1,52 @@ | |||
| <!doctype html> | |||
There was a problem hiding this comment.
Not sure we should add this example at all to be honest.
| * @param {string} noScriptText | ||
| * @param {"div" | "li"} as | ||
| */ | ||
| export function region(name, noScriptText, as = "div") { |
There was a problem hiding this comment.
Maybe more clear:
| export function region(name, noScriptText, as = "div") { | |
| export function region(name, noScriptText, elementName = "div") { |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Type-qualified and joint group configurations currently generate incorrect links and header markup.
Review effort: Balanced
Findings: 4
Open (6)
Use the shortname when constructing group join URLs · New Parse the shortname from type-qualified group identifiers · New Render separate copyright links for joint groups · New Correct test fixture to use type/shortname group format · New Include new statuses in the invalid-status recovery hint · New Fix ungrammatical status information sentence · New
What changed in this PR
Adds redesigned CG-LIVING and CG-SNAPSHOT Community Group profiles with dedicated headers, metadata, assets, and supporting sections.
Changes:
- Adds CG profile configuration, validation, templates, and pipeline modules.
- Integrates external CG assets and metadata regions.
- Adds comprehensive integration and unit coverage plus an example document.
| File | Description |
|---|---|
tests/unit/w3c/cg-headers-spec.js |
Tests snapshot-index URL generation. |
tests/spec/w3c/cg-spec.js |
Covers profiles, metadata, assets, and variants. |
src/w3c/templates/cg-sotd.js |
Adds the redesigned minimal SotD. |
src/w3c/templates/cg-headers.js |
Builds redesigned CG headers. |
src/w3c/style.js |
Selects CG-specific assets. |
src/w3c/headers.js |
Registers statuses and templates. |
src/w3c/defaults.js |
Validates new configuration options. |
src/w3c/cg-spec.js |
Emits CG metadata identity. |
src/w3c/cg-sections.js |
Adds involvement and usage sections. |
src/w3c/cg-assets.js |
Loads and restores CG assets. |
src/type-helper.d.ts |
Types the new configuration. |
profiles/w3c.js |
Registers the new modules. |
examples/cg-living.html |
Demonstrates the living profile. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // TODO: | ||
| // - `conf.group` is an array for joint publications | ||
| // - `conf.group` is an id | ||
| const group = typeof conf.group === "string" ? conf.group.split("/")[0] : ""; |
| the Contributors to the ${titleNodes} Specification, published by the | ||
| <a href="${conf.wgURI}">${conf.wg}</a> under the ${agreement} |
There was a problem hiding this comment.
At this stage, my expectation is that CG specs will be produced by a single CG
| The text of this specification and the status information support | ||
| for this specification are expected to change in place at this | ||
| address. |
There was a problem hiding this comment.
@ianbjacobs See this copilot suggestion on the text we expect at the top of the specs.
marcoscaceres
left a comment
There was a problem hiding this comment.
Some initial feedback...
| * @param {"div" | "li"} elementName | ||
| */ | ||
| export function region(name, noScriptText, elementName = "div") { | ||
| const message = document.createElement("p"); |
There was a problem hiding this comment.
Nit: this can probably just be a hyperHTML template. Easier to read.
| const group = | ||
| typeof conf.group === "string" ? conf.group.split("/", 2).at(-1) : ""; | ||
| if (!group || !conf.shortName) return ""; | ||
| const base = `${INCUBATION}groups/${encodeURIComponent(group)}/specs/`; |
There was a problem hiding this comment.
Maybe safer/cleaner to use new URL(path , INCUBATION) here and have it return the .href?
| if (conf.specStatus !== "CG-SNAPSHOT") return ""; | ||
| if (!conf.shortName || !conf.publishDate) return ""; | ||
| const dated = `${conf.shortName}-${concatDate(conf.publishDate)}`; | ||
| return `${INCUBATION}specs/${encodeURIComponent(dated)}/`; |
There was a problem hiding this comment.
As above... use new URL() for URL parsing.
| </li> | ||
| </ul> | ||
| </div>`; | ||
| default: |
There was a problem hiding this comment.
default: should probably be a RespecError to catch unsupported/unexpected cases.
| * @param {string} noScriptText | ||
| * @param {"div" | "li"} elementName | ||
| */ | ||
| export function region(name, noScriptText, elementName = "div") { |
There was a problem hiding this comment.
Nit: createRegion() maybe?
| */ | ||
| function createScript(path) { | ||
| const src = cgAssetUrl(path); | ||
| const script = path.endsWith("cg-metadata.js") |
There was a problem hiding this comment.
As above... this seems somewhat fragile... something like createScript(path, options = {defer: false, async: false}) might be better
| // is no one page to send a reader to for a joint publication. | ||
| const joinURL = | ||
| typeof conf.group === "string" | ||
| ? `${COMMUNITY}${conf.group.split("/", 2).at(-1)}/join` |
There was a problem hiding this comment.
As above... might be better to use new URL to construct these URLs.
| "usage-guidance", | ||
| "The usage guidance for this specification is loaded from the status metadata, which needs JavaScript." | ||
| )} | ||
| ${DISCLAIMER}` |
There was a problem hiding this comment.
DISCLAIMER can probably just be inlined.
| const message = document.createElement("p"); | ||
| message.className = "cg-metadata-unavailable"; | ||
| message.textContent = noScriptText; | ||
| const fallback = document.createElement("noscript"); |
There was a problem hiding this comment.
I'm not sure any other feature uses noscript... given fixup.js will presumably be loaded, I wonder things will break regardless if JS is disabled?
| } | ||
| } | ||
|
|
||
| const CG_MATURITIES = ["draft", "transferred", "unmaintained"]; |
There was a problem hiding this comment.
I'm a bit confused about "transferred"... if the document has been transferred, won't it just be a WD or ED? or is the expectation that transferred things would still be maintained? My experience has been that once transferred, they just transition to an appropriate W3C status.
sidvishnoi
left a comment
There was a problem hiding this comment.
I'll do some more passes after trying it locally..
| function noticeBox(conf) { | ||
| switch (cgVariant(conf)) { | ||
| case "snapshot": | ||
| return html`<div class="box box--information"> |
There was a problem hiding this comment.
Nit: the templates here can be moved into individual functions, so it's cleaner. e.g. noticeBoxSnapshot(conf), noticeBoxTransferred(conf)


CG-LIVINGandCG-SNAPSHOTfollowing the upcoming updates with the CG spec lifecycle. These profiles use different headers (see mockups) and rely on assets and metadata. The existing profilesCG-DRAFTandCG-FINALremain untouched.cgMaturity(draft,transferredorunmaintained) andtransferredTo(only applies ifcgMaturity = transferred)Description of the new processing files:
src/w3c/templates/cg-headers.jsbuilds the redesign headers for the 4 variants (draft, transferred, unmaintained and snapshot) and adds the different containers (with adata-cg-regionattribute) thatcg-metadatafills when the spec loadssrc/w3c/cg-sections.jsadds the "Get involved" and "Usage guidance" sectionssrc/w3c/cg-spec.jsemits three new tags thatcg-metadatarelies on to fetch the appropriate metadatasrc/w3c/templates/cg-sotd.jsreduces the SotD to what the editors wrote (we do not have required paragraphs for the new profiles)Some URLs are still subject to change so it's not ready to be merged.