Skip to content

Commit 532530e

Browse files
authored
Add support for issueLabel field (#576)
1 parent 25469ee commit 532530e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ These are available to multiple data types, as specified in each respective sect
8282
- `true` indicates the slug to reach the howto is consistent with the folder and filename of the current file
8383
- A string value indicates an exact slug
8484
- *This should currently be avoided until the informative documentation is revisited*
85+
- `issueLabel` - Optional string; specifies the issue label corresponding to a provision
86+
- This is only necessary when the label does not match the provision's title, e.g. if a provision is renamed after it was first published
87+
- Excludes the "P - " prefix
88+
- It may help to think of this as a "legacy title" field
8589
- `status` - Optional string: one of the status indicators outlined in the Explainer (in lowercase)
8690
- `title` - Optional title of the guideline, requirement, or term
8791
- If unspecified, this will be derived from the slug,
@@ -103,15 +107,15 @@ Represents each fourth-level heading that multiple provisions (requirements/asse
103107
are listed under. Each guideline is defined in a Markdown file, with its child
104108
provisions located in a subdirectory with the same name.
105109

106-
- Supports [common fields](#common-fields): `children`, `howto`, `status`, `title`
110+
- Supports [common fields](#common-fields): `children`, `howto`, `issueLabel`, `status`, `title`
107111
- `status` for guidelines is optional, limited to `developing`, `refining`, `mature`
108112
- No additional unique fields
109113

110114
#### Provisions
111115

112116
Represents each fifth-level heading specifying an individual requirement or assertion.
113117

114-
- Supports [common fields](#common-fields): `howto`, `status`, `title`
118+
- Supports [common fields](#common-fields): `howto`, `issueLabel`, `status`, `title`
115119
- `status` for requirements and assertions defaults to `exploratory` if not specified
116120
- `needsAdditionalResearch` - Optional boolean, indicating whether to
117121
display a "needs additional research" editor's note

src/components/guidelines/EntryText.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import { getEntry, type CollectionEntry } from "astro:content";
33
import { load } from "cheerio";
4+
import capitalize from "lodash-es/capitalize";
45
56
import { computeGuidelineTitle } from "@/lib/guidelines";
67
@@ -49,7 +50,9 @@ function processHtml() {
4950
if (entry.collection === "requirements") {
5051
doclinks.push(`
5152
<p>
52-
<a href="https://github.com/w3c/wcag3/issues?q=state%3Aopen%20label%3A%22P%20-%20${encodeURIComponent(entryTitle.replace(/,/g, ""))}%22">
53+
<a href="https://github.com/w3c/wcag3/issues?q=state%3Aopen%20label%3A%22P%20-%20${
54+
encodeURIComponent((capitalize(entry.data.issueLabel) || entryTitle).replace(/,/g, ""))
55+
}%22">
5356
<svg aria-hidden="true" class="i-list">
5457
<use xlink:href="img/icons.svg#i-list" />
5558
</svg>

src/content.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ export const collections = {
5858
// Moreover, we can't override generateId for requirements to only use slug,
5959
// due to duplicates across separate guidelines, e.g. "style-guide"
6060
children: childrenSchema,
61+
issueLabel: z.string().optional(),
6162
status: parentStatusSchema.optional(),
6263
}),
6364
}),
6465
requirements: defineCollection({
6566
loader: glob({ pattern: "*/*/*.md", base: "./guidelines/groups" }),
6667
schema: commonChildSchema.extend({
6768
tags: z.array(reference("tags")).optional(),
69+
issueLabel: z.string().optional(),
6870
needsAdditionalResearch: z.boolean().optional(),
6971
status: statusSchema.default("exploratory"),
7072
type: z

0 commit comments

Comments
 (0)