@allons-y/course-kit 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +90 -2
  3. package/assets/fonts/instrument-sans-italic-var.woff2 +0 -0
  4. package/assets/fonts/instrument-sans-var.woff2 +0 -0
  5. package/assets/fonts/pt-mono.woff2 +0 -0
  6. package/assets/scripts/copy.js +99 -0
  7. package/assets/scripts/deck.js +161 -0
  8. package/assets/scripts/email.js +19 -0
  9. package/assets/scripts/practice.js +545 -0
  10. package/assets/scripts/theme-panel.js +647 -0
  11. package/assets/scripts/theme-restore.js +17 -0
  12. package/assets/styles/base.css +2091 -0
  13. package/assets/styles/deck.css +968 -0
  14. package/assets/styles/font.css +36 -0
  15. package/assets/styles/notes.css +137 -0
  16. package/assets/styles/print.css +428 -0
  17. package/assets/styles/semantics.css +101 -0
  18. package/components/practice/check-controls.webc +50 -0
  19. package/components/practice/choice-list.webc +86 -0
  20. package/components/practice/cite-panel.webc +108 -0
  21. package/components/practice/practice-figure.webc +47 -0
  22. package/components/practice/practice-fill.webc +154 -0
  23. package/components/practice/practice-grid.webc +82 -0
  24. package/components/practice/practice-judge.webc +165 -0
  25. package/components/practice/practice-match.webc +178 -0
  26. package/components/practice/practice-question.webc +141 -0
  27. package/components/practice/practice-selfcheck.webc +40 -0
  28. package/components/practice/practice-terms.webc +95 -0
  29. package/components/practice/practice-tree.webc +91 -0
  30. package/components/practice/practice-worksheet.webc +369 -0
  31. package/components/site/copyright.webc +13 -0
  32. package/components/site/course-documents.webc +27 -0
  33. package/components/site/course-now.webc +393 -0
  34. package/components/site/course-summary.webc +136 -0
  35. package/components/site/demo-weeks.webc +91 -0
  36. package/components/site/glossary-entry.webc +31 -0
  37. package/components/site/glossary-panel.webc +1482 -0
  38. package/components/site/glossary.webc +45 -0
  39. package/components/site/grading.webc +50 -0
  40. package/components/site/instructor.webc +432 -0
  41. package/components/site/masthead.webc +147 -0
  42. package/components/site/nav-links.webc +174 -0
  43. package/components/site/policies.webc +17 -0
  44. package/components/site/practice-index.webc +31 -0
  45. package/components/site/schedule-overview.webc +145 -0
  46. package/components/site/schedule-weeks.webc +589 -0
  47. package/components/site/site-footer.webc +119 -0
  48. package/components/site/slide-timetable.webc +152 -0
  49. package/components/site/syllabus.webc +370 -0
  50. package/components/ui/arrow-link.webc +19 -0
  51. package/components/ui/assigned-list.webc +101 -0
  52. package/components/ui/callout.webc +11 -0
  53. package/components/ui/card-list.webc +124 -0
  54. package/components/ui/codepen-embed.webc +123 -0
  55. package/components/ui/download-button.webc +49 -0
  56. package/components/ui/eyebrow.webc +18 -0
  57. package/components/ui/icons/github.webc +6 -0
  58. package/components/ui/icons/google.webc +9 -0
  59. package/components/ui/link-list.webc +130 -0
  60. package/components/ui/link-section.webc +40 -0
  61. package/components/ui/meeting-card.webc +73 -0
  62. package/components/ui/meeting-decks.webc +38 -0
  63. package/components/ui/table-rubric.webc +251 -0
  64. package/components/ui/today-link.webc +43 -0
  65. package/components/ui/today-marker.webc +149 -0
  66. package/components/ui/week-block.webc +53 -0
  67. package/examples/starter/_data/course.json +20 -0
  68. package/examples/starter/_data/dates.json +16 -0
  69. package/examples/starter/_data/grading.json +6 -0
  70. package/examples/starter/_data/instructor.json +7 -0
  71. package/examples/starter/_data/policies.json +9 -0
  72. package/examples/starter/_data/scale.json +8 -0
  73. package/examples/starter/_data/schedule.json +22 -0
  74. package/examples/starter/_data/theme.json +17 -0
  75. package/examples/starter/content/index.webc +12 -0
  76. package/examples/starter/content/schedule.webc +12 -0
  77. package/examples/starter/content/slides/index.11tydata.js +5 -0
  78. package/examples/starter/content/slides/index.webc +12 -0
  79. package/examples/starter/content/slides/week-1-day-1.md +40 -0
  80. package/examples/starter/eleventy.config.js +8 -0
  81. package/glue/deck-notes.data.js +41 -0
  82. package/glue/deck-notes.webc +32 -0
  83. package/glue/lesson-day.data.js +17 -0
  84. package/glue/lesson-day.webc +0 -0
  85. package/glue/lesson-plans.data.js +13 -0
  86. package/glue/lesson-plans.webc +2 -0
  87. package/index.js +6 -0
  88. package/layouts/base.webc +79 -0
  89. package/layouts/deck.webc +46 -0
  90. package/layouts/demo.webc +16 -0
  91. package/layouts/document.webc +10 -0
  92. package/layouts/lesson-detail.webc +109 -0
  93. package/layouts/lesson.webc +71 -0
  94. package/layouts/notes.webc +23 -0
  95. package/layouts/worksheet.webc +52 -0
  96. package/lib/assets.js +42 -0
  97. package/lib/bundles.js +79 -0
  98. package/lib/check.js +110 -0
  99. package/lib/components.js +19 -0
  100. package/lib/copy.js +656 -0
  101. package/lib/data/build.js +22 -0
  102. package/lib/data/fonts.js +16 -0
  103. package/lib/data/glossary.js +304 -0
  104. package/lib/data/index.js +8 -0
  105. package/lib/data/lessons.js +173 -0
  106. package/lib/data/project.js +22 -0
  107. package/lib/data/read.js +61 -0
  108. package/lib/data/site.js +70 -0
  109. package/lib/data/term.js +80 -0
  110. package/lib/extensions.js +70 -0
  111. package/lib/files.js +14 -0
  112. package/lib/filters.js +584 -0
  113. package/lib/fit.js +106 -0
  114. package/lib/glue.js +26 -0
  115. package/lib/lesson-materials.js +66 -0
  116. package/lib/markdown.js +568 -0
  117. package/lib/minify.js +53 -0
  118. package/lib/paths.js +5 -0
  119. package/lib/pdf.js +134 -0
  120. package/lib/plugin.js +231 -0
  121. package/lib/plugins.js +34 -0
  122. package/lib/postcss.js +93 -0
  123. package/lib/theme-server.js +88 -0
  124. package/lib/theme.js +185 -0
  125. package/lib/worksheet-dialect.js +415 -0
  126. package/lib/worksheets.js +276 -0
  127. package/package.json +119 -4
  128. package/schemas/course.schema.json +161 -0
  129. package/schemas/dates.schema.json +165 -0
  130. package/schemas/grading.schema.json +59 -0
  131. package/schemas/instructor.schema.json +76 -0
  132. package/schemas/policies.schema.json +90 -0
  133. package/schemas/project.schema.json +209 -0
  134. package/schemas/scale.schema.json +68 -0
  135. package/schemas/schedule.schema.json +260 -0
  136. package/schemas/theme.schema.json +704 -0
  137. package/schemas/worksheet.schema.json +449 -0
@@ -0,0 +1,276 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { relative } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ import { resolveCopy } from "./copy.js";
7
+ import { readCourseData, readPackage } from "./data/read.js";
8
+ import { resolveSite } from "./data/site.js";
9
+ import { parseWorksheet } from "./worksheet-dialect.js";
10
+
11
+ export { parseWorksheet };
12
+
13
+ const CHECK_MODES = ["question", "end"];
14
+
15
+ /** The site-level defaults a worksheet falls back to; set once by `courseKit({ worksheets })`. */
16
+ let defaults = { checkMode: "end" };
17
+
18
+ /**
19
+ * Set the site-level worksheet defaults.
20
+ * @param {{ checkMode?: "question" | "end" }} [options]
21
+ */
22
+ export function setWorksheetDefaults({ checkMode } = {}) {
23
+ if (checkMode !== undefined && !CHECK_MODES.includes(checkMode)) throw new Error(`worksheets.checkMode is "${checkMode}", but it must be "question" or "end".`);
24
+ defaults = { checkMode: checkMode ?? "end" };
25
+ }
26
+
27
+ /* `createRequire`, never ESM import: Prism's component loader is CJS. */
28
+ const require = createRequire(import.meta.url);
29
+ const Prism = require("prismjs");
30
+ require("prismjs/components/index.js")(["python"]);
31
+
32
+ const escapeHtml = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
33
+
34
+ /**
35
+ * Highlight a snippet with Prism, or escape it when the language is unknown.
36
+ * @param {string} code
37
+ * @param {string} [lang] the fence language
38
+ * @returns {string} HTML
39
+ */
40
+ const highlight = (code, lang) => {
41
+ const grammar = lang && Prism.languages[lang];
42
+ return grammar ? Prism.highlight(code, grammar, lang) : escapeHtml(code);
43
+ };
44
+
45
+ /**
46
+ * Split highlighted HTML into one balanced fragment per source line: a token
47
+ * that spans a newline is closed at the end of the line and reopened on the
48
+ * next, so each line renders on its own.
49
+ * @param {string} html Prism output, whose only tags are spans
50
+ * @returns {string[]}
51
+ */
52
+ const splitHighlightedLines = (html) => {
53
+ const lines = [""];
54
+ const open = [];
55
+ for (const part of html.split(/(<span[^>]*>|<\/span>|\n)/)) {
56
+ if (part === "\n") {
57
+ lines[lines.length - 1] += "</span>".repeat(open.length);
58
+ lines.push(open.join(""));
59
+ } else if (part.startsWith("<span")) {
60
+ open.push(part);
61
+ lines[lines.length - 1] += part;
62
+ } else if (part === "</span>") {
63
+ open.pop();
64
+ lines[lines.length - 1] += part;
65
+ } else lines[lines.length - 1] += part;
66
+ }
67
+ return lines;
68
+ };
69
+
70
+ /* ---- Practice worksheets ---------------------------------------------- */
71
+
72
+ /** Option letters, in order. Eight is the most any bank has needed. */
73
+ const LETTERS = "abcdefgh";
74
+
75
+ /**
76
+ * Absolute form of a site path, so a link survives the page being uploaded
77
+ * somewhere else. Anything already absolute is left alone.
78
+ * @param {string} path
79
+ * @returns {string}
80
+ */
81
+ const onSite = (path, hostname) => (path.startsWith("/") ? `${hostname}${path}` : path);
82
+
83
+ /**
84
+ * Resolve a citation to a URL. A source may name a slide by week/day/number,
85
+ * which keeps deck URLs out of the authored data, or carry its own `href` for
86
+ * anything else (a reading, a guide, an external page). Site paths come back
87
+ * absolute: a worksheet is a single file students download, and a
88
+ * root-relative citation resolves against whatever host opened it.
89
+ * @param {{href?: string, week?: number, day?: number, slide?: number}} source
90
+ * @returns {string|undefined}
91
+ */
92
+ const sourceHref = (source, hostname) => {
93
+ if (!source) return undefined;
94
+ if (source.href) return onSite(source.href, hostname);
95
+ if (typeof source.week !== "number" || typeof source.day !== "number") return undefined;
96
+ const anchor = typeof source.slide === "number" ? `#s${source.slide}` : "";
97
+ return onSite(`/slides/week-${source.week}-day-${source.day}/${anchor}`, hostname);
98
+ };
99
+
100
+ const withHref = (source, hostname) => (source ? { ...source, href: sourceHref(source, hostname) } : source);
101
+
102
+ /**
103
+ * The subset of a question's key the client script grades against. Derived
104
+ * from the authored answer so there is never a second copy to keep in step.
105
+ * @param {object} question
106
+ * @returns {object}
107
+ */
108
+ const answersFor = (question) => {
109
+ switch (question.kind) {
110
+ case "choice":
111
+ return { answer: question.answer };
112
+ case "match":
113
+ return { items: question.items.map((item) => item.answer) };
114
+ case "fill":
115
+ case "tree":
116
+ return { blanks: question.blanks.map((blank) => blank.accept) };
117
+ case "grid":
118
+ return { rows: question.rows.map((row) => row.answer) };
119
+ case "judge":
120
+ return { answer: question.answer, lines: question.lineAnswers ?? [] };
121
+ default:
122
+ return {};
123
+ }
124
+ };
125
+
126
+ /**
127
+ * Flatten one authored question into render-ready rows.
128
+ *
129
+ * WebC evaluates a `webc:for` element's own attributes in a scope holding only
130
+ * that loop's variables, so a nested loop cannot reach the enclosing one. Every
131
+ * field a looped element needs — the input `name` above all — is therefore
132
+ * folded into the row it loops over, here. Indexes become strings because WebC
133
+ * drops a dynamic attribute whose value is `0`.
134
+ * @param {object} question
135
+ * @param {object} section the question's section, for the judge verdict legend
136
+ * @returns {object}
137
+ */
138
+ const prepareQuestion = (question, section, hostname) => {
139
+ const id = question.id;
140
+ const draggable = question.dragDrop ? "true" : undefined;
141
+ const prepared = {
142
+ ...question,
143
+ answers: answersFor(question),
144
+ sources: (question.sources ?? []).map((source) => withHref(source, hostname)),
145
+ };
146
+ if (question.code) prepared.codeHtml = highlight(question.code, question.lang);
147
+
148
+ if (question.kind === "choice") {
149
+ prepared.choices = question.options.map((text, index) => ({
150
+ text,
151
+ letter: LETTERS[index],
152
+ name: `${id}-choice`,
153
+ value: String(index),
154
+ }));
155
+ }
156
+
157
+ if (question.kind === "match") {
158
+ prepared.bank = question.bank.map((entry) => ({ ...entry, draggable }));
159
+ prepared.items = question.items.map((item, index) => ({
160
+ ...item,
161
+ source: withHref(item.source, hostname),
162
+ bank: prepared.bank,
163
+ drop: draggable,
164
+ name: `${id}-match-${index}`,
165
+ index: String(index),
166
+ }));
167
+ }
168
+
169
+ if (question.kind === "fill") {
170
+ if (Array.isArray(question.bank)) {
171
+ prepared.bank = question.bank.map((word) => ({ text: word, draggable }));
172
+ }
173
+ prepared.blanks = question.blanks.map((blank, index) => ({
174
+ ...blank,
175
+ drop: draggable,
176
+ name: `${id}-blank-${index}`,
177
+ hint: blank.hint ?? "",
178
+ index: String(index),
179
+ }));
180
+ }
181
+
182
+ if (question.kind === "tree") {
183
+ prepared.nodes = question.nodes.map((node) => {
184
+ if (node.label !== undefined) return { ...node, depth: String(node.depth) };
185
+ const blank = question.blanks[node.blank];
186
+ return {
187
+ ...node,
188
+ depth: String(node.depth),
189
+ blank: String(node.blank),
190
+ name: `${id}-blank-${node.blank}`,
191
+ blankLabel: blank.label,
192
+ display: blank.display,
193
+ };
194
+ });
195
+ }
196
+
197
+ if (question.kind === "grid") {
198
+ prepared.rows = question.rows.map((row, rowIndex) => ({
199
+ ...row,
200
+ display: question.columns[row.answer],
201
+ index: String(rowIndex),
202
+ cells: question.columns.map((column, columnIndex) => ({
203
+ column,
204
+ name: `${id}-row-${rowIndex}`,
205
+ value: String(columnIndex),
206
+ })),
207
+ }));
208
+ }
209
+
210
+ if (question.kind === "judge") {
211
+ const highlighted = splitHighlightedLines(highlight(question.lines.join("\n"), question.lang));
212
+ prepared.codeLines = question.lines.map((line, index) => ({
213
+ line,
214
+ html: highlighted[index],
215
+ name: `${id}-line`,
216
+ value: String(index),
217
+ }));
218
+ prepared.lineName = `${id}-line`;
219
+ prepared.verdicts = (section.legend ?? []).map((entry, index) => ({
220
+ ...entry,
221
+ name: `${id}-choice`,
222
+ value: String(index),
223
+ }));
224
+ }
225
+
226
+ return prepared;
227
+ };
228
+
229
+ /**
230
+ * Turn an authored worksheet (see `schemas/worksheet.schema.json`) into the
231
+ * data cascade `<practice-worksheet>` renders. One call is the whole of a
232
+ * worksheet's `.11tydata.js`.
233
+ * @param {object} authored the parsed worksheet JSON
234
+ * @param {{ hostname?: string }} [options] the site's origin, which makes site paths absolute
235
+ * @returns {object} `{ layout, title, description, indexed, worksheet }`
236
+ */
237
+ export const prepareWorksheet = (authored, { hostname = "" } = {}) => {
238
+ const { title, description, indexed, ...worksheet } = authored;
239
+ delete worksheet.$schema;
240
+ const checkMode = worksheet.checkMode ?? defaults.checkMode;
241
+ if (!CHECK_MODES.includes(checkMode)) throw new Error(`worksheet "${title}": checkMode is "${checkMode}", but it must be "question" or "end".`);
242
+ return {
243
+ layout: "worksheet",
244
+ title,
245
+ description,
246
+ indexed: indexed ?? true,
247
+ worksheet: {
248
+ ...worksheet,
249
+ checkMode,
250
+ copy: { ...resolveCopy().worksheet, ...(worksheet.copy ?? {}) },
251
+ footer: worksheet.footer ?? [],
252
+ links: (worksheet.links ?? []).map((link) => withHref(link, hostname)),
253
+ terms: (worksheet.terms ?? []).map((entry, index) => ({
254
+ ...entry,
255
+ id: `term-${index + 1}`,
256
+ source: withHref(entry.source, hostname),
257
+ })),
258
+ sections: (worksheet.sections ?? []).map((section) => ({
259
+ ...section,
260
+ questions: section.questions.map((question) => prepareQuestion(question, section, hostname)),
261
+ })),
262
+ },
263
+ };
264
+ };
265
+
266
+ /**
267
+ * The whole of a worksheet's `.11tydata.js`: parse the `.worksheet.md` beside it and prepare it for its page.
268
+ * @param {string} metaUrl the data file's `import.meta.url`
269
+ * @param {{ dataDir?: string }} [options]
270
+ * @returns {object}
271
+ */
272
+ export function worksheetData(metaUrl, { dataDir = "_data" } = {}) {
273
+ const source = fileURLToPath(metaUrl).replace(/\.11tydata\.js$/, ".worksheet.md");
274
+ const { hostname } = resolveSite({ course: readCourseData(dataDir).course, pkg: readPackage() });
275
+ return prepareWorksheet(parseWorksheet(readFileSync(source, "utf8"), relative(process.cwd(), source)), { hostname });
276
+ }
package/package.json CHANGED
@@ -1,6 +1,121 @@
1
1
  {
2
2
  "name": "@allons-y/course-kit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Shared layouts, components, styles and build helpers for Eleventy course sites.",
5
+ "license": "MPL-2.0",
6
+ "author": "Cassondra Roberts <castastrophe@users.noreply.github.com> (https://allons-y.studio)",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/allonsy-studio/course-kit.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/allonsy-studio/course-kit/issues"
13
+ },
14
+ "type": "module",
15
+ "exports": {
16
+ ".": "./index.js",
17
+ "./data": "./lib/data/index.js",
18
+ "./filters": "./lib/filters.js",
19
+ "./markdown": "./lib/markdown.js",
20
+ "./package.json": "./package.json",
21
+ "./postcss": "./lib/postcss.js",
22
+ "./schemas/*": "./schemas/*",
23
+ "./theme": "./lib/theme.js",
24
+ "./worksheets": "./lib/worksheets.js"
25
+ },
26
+ "files": [
27
+ "index.js",
28
+ "lib",
29
+ "layouts",
30
+ "components",
31
+ "assets",
32
+ "glue",
33
+ "schemas",
34
+ "examples/starter"
35
+ ],
36
+ "scripts": {
37
+ "test": "node --test",
38
+ "schema": "node scripts/theme-schema.js && node scripts/theme-docs.js",
39
+ "docs": "node scripts/component-docs.js && node scripts/copy-docs.js",
40
+ "preview": "node scripts/site.js start",
41
+ "preview:build": "node scripts/site.js build",
42
+ "docs:build": "node scripts/site.js build",
43
+ "docs:start": "node scripts/site.js start",
44
+ "docs:test": "cypress run --project website",
45
+ "pages:build": "node scripts/site.js build",
46
+ "format": "opx lint --fix",
47
+ "lint": "opx lint",
48
+ "changeset": "opx release add",
49
+ "version": "opx release version && yarn install --mode update-lockfile",
50
+ "release": "opx release publish"
51
+ },
52
+ "dependencies": {
53
+ "@11ty/eleventy-navigation": "^1.0.5",
54
+ "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.2",
55
+ "@11ty/eleventy-plugin-webc": "^0.11.2",
56
+ "@allons-y/dashly": "^1.0.0-beta.1",
57
+ "cssnano": "^9.9.0",
58
+ "cssnano-preset-advanced": "^9.7.0",
59
+ "dotenv": "^17.4.2",
60
+ "eleventy-plugin-toc": "^1.1.5",
61
+ "esbuild": "^0.28.2",
62
+ "gray-matter": "^4.0.3",
63
+ "html-minifier-terser": "^7.2.0",
64
+ "htmlnano": "^3.6.1",
65
+ "markdown-it": "^14.3.3",
66
+ "markdown-it-anchor": "^10.0.0",
67
+ "markdown-it-footnote": "^4.0.0",
68
+ "postcss": "^8.5.32",
69
+ "postcss-import": "^17.0.1",
70
+ "postcss-preset-env": "^11.6.2",
71
+ "posthtml": "^0.16.7",
72
+ "prettier": "^3.9.10",
73
+ "prism-themes": "^1.9.0",
74
+ "prismjs": "^1.30.0"
75
+ },
76
+ "peerDependencies": {
77
+ "@11ty/eleventy": "^3.1.0",
78
+ "@pyscript/core": ">=0.7",
79
+ "puppeteer": ">=24",
80
+ "pyodide": ">=314"
81
+ },
82
+ "peerDependenciesMeta": {
83
+ "@pyscript/core": {
84
+ "optional": true
85
+ },
86
+ "puppeteer": {
87
+ "optional": true
88
+ },
89
+ "pyodide": {
90
+ "optional": true
91
+ }
92
+ },
93
+ "engines": {
94
+ "node": ">=24"
95
+ },
96
+ "packageManager": "yarn@4.18.1",
97
+ "devDependencies": {
98
+ "@11ty/eleventy": "^3.1.8",
99
+ "@allons-y/opx-cli": "^0.2.0",
100
+ "@allons-y/opx-lint-js": "^1.0.0",
101
+ "@allons-y/opx-lint-json": "^0.1.0",
102
+ "@allons-y/opx-lint-md": "^0.1.0",
103
+ "@allons-y/opx-release": "^0.1.1",
104
+ "@allons-y/webc-code-sample": "0.1.0-beta.3",
105
+ "@allons-y/webc-oss-site": "0.1.0-beta.3",
106
+ "@allons-y/webc-patterns": "0.1.0-beta.3",
107
+ "ajv": "^8.20.0",
108
+ "ajv-formats": "^3.0.1",
109
+ "axe-core": "^4.14.0",
110
+ "cypress": "^15.21.1",
111
+ "cypress-axe": "^1.7.0"
112
+ },
113
+ "oss-docs": {
114
+ "site": "website",
115
+ "flavor": "landing"
116
+ },
117
+ "publishConfig": {
118
+ "access": "public",
119
+ "provenance": true
120
+ }
121
+ }
@@ -0,0 +1,161 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "/schemas/course.schema.json",
4
+ "title": "Course section",
5
+ "description": "Content model for the course's identity and catalog copy (_data/course.json, exposed as the `course` global). Several properties are elements Meredith College requires on every syllabus. Think before removing a property or loosening `required`. Property order here is the suggested authoring order.",
6
+ "type": "object",
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "description": "Relative path to this schema, for editor validation."
11
+ },
12
+ "code": {
13
+ "type": "string",
14
+ "pattern": "^[A-Z]+[0-9]+$",
15
+ "description": "Catalog code in display casing (e.g. CS101) — the course number Meredith requires on the syllabus. Slugs derive by lowercasing."
16
+ },
17
+ "name": {
18
+ "type": "string",
19
+ "description": "Course name as it appears in the catalog — the course name Meredith requires on the syllabus. NOT `title`: page titles (\"CODE: Name (Term)\") are computed by the kit."
20
+ },
21
+ "status": {
22
+ "type": "string",
23
+ "examples": [
24
+ "upcoming",
25
+ "active",
26
+ "archived"
27
+ ],
28
+ "default": "active",
29
+ "description": "Lifecycle state of the section; drives listing copy."
30
+ },
31
+ "term": {
32
+ "type": "object",
33
+ "required": [
34
+ "year",
35
+ "season"
36
+ ],
37
+ "additionalProperties": false,
38
+ "properties": {
39
+ "year": {
40
+ "type": "integer",
41
+ "minimum": 2000
42
+ },
43
+ "season": {
44
+ "enum": [
45
+ "spring",
46
+ "summer",
47
+ "fall"
48
+ ]
49
+ }
50
+ },
51
+ "description": "The term this section runs in. Must name an entry in _data/dates.json (year, then season), so a new term is one edit here plus the calendar."
52
+ },
53
+ "description": {
54
+ "type": "string",
55
+ "description": "Catalog description, verbatim — Meredith requires the catalog description on the syllabus, so do not editorialize here; section-specific prose belongs in `approach`."
56
+ },
57
+ "approach": {
58
+ "type": "string",
59
+ "description": "Optional section-specific framing of how THIS section runs the course; the catalog `description` stays untouched."
60
+ },
61
+ "prerequisites": {
62
+ "type": "array",
63
+ "items": {
64
+ "type": "string"
65
+ },
66
+ "description": "Prerequisite course codes (display casing)."
67
+ },
68
+ "prerequisiteNote": {
69
+ "type": "string",
70
+ "description": "Qualifier appended to the prerequisite list, e.g. the grade floor: \"with a grade of C or better\"."
71
+ },
72
+ "outcomes": {
73
+ "type": "array",
74
+ "minItems": 1,
75
+ "items": {
76
+ "type": "string"
77
+ },
78
+ "description": "The committed catalog outcomes, verbatim — the course objectives and expected learning outcomes Meredith requires, each stating what students will know and be able to do. Section extras go in `additionalOutcomes`."
79
+ },
80
+ "additionalOutcomes": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "string"
84
+ },
85
+ "description": "Section-specific outcomes layered on top of the committed catalog set."
86
+ },
87
+ "syllabusContents": {
88
+ "type": "boolean",
89
+ "default": true,
90
+ "description": "Whether the `<syllabus>` shows its contents list (a row of links above the syllabus, and from 1100px a sticky column beside it). `false` leaves it out. The tag's `contents=\"false\"` attribute does the same for one place and wins over this."
91
+ },
92
+ "textbook": {
93
+ "type": "object",
94
+ "description": "Required text and how to get it — the textbook/materials element Meredith requires. Omit the whole key ONLY when the course has no text: the `<syllabus>` component then renders \"No text is required.\", which is still an explicit materials statement. Never leave the key present but empty.",
95
+ "properties": {
96
+ "required": {
97
+ "type": "string",
98
+ "description": "The required text, including cost/format notes (e.g. \"free, online\")."
99
+ },
100
+ "access": {
101
+ "type": "array",
102
+ "items": {
103
+ "type": "string"
104
+ },
105
+ "description": "Ordered steps for getting access."
106
+ }
107
+ },
108
+ "required": [
109
+ "required"
110
+ ],
111
+ "additionalProperties": false
112
+ },
113
+ "requirements": {
114
+ "type": "array",
115
+ "minItems": 1,
116
+ "items": {
117
+ "type": "string"
118
+ },
119
+ "description": "Non-textbook requirements: software, hardware, accounts. Meredith requires a statement about required access to technology; the `<syllabus>` component always prints the laptop sentence and appends these, so list every tool students must install or sign up for (or say explicitly that nothing beyond the laptop is needed)."
120
+ },
121
+ "documents": {
122
+ "type": "array",
123
+ "items": {
124
+ "$ref": "#/$defs/link"
125
+ },
126
+ "description": "Course-wide documents (syllabus PDF, project specs, policies) shown on the landing page; per-week material belongs in that week's `resources`."
127
+ }
128
+ },
129
+ "required": [
130
+ "code",
131
+ "name",
132
+ "status",
133
+ "description",
134
+ "outcomes",
135
+ "requirements"
136
+ ],
137
+ "additionalProperties": true,
138
+ "$defs": {
139
+ "link": {
140
+ "type": "object",
141
+ "properties": {
142
+ "title": {
143
+ "type": "string"
144
+ },
145
+ "description": {
146
+ "type": "string",
147
+ "description": "Optional description of the link."
148
+ },
149
+ "href": {
150
+ "type": "string",
151
+ "description": "Absolute URL for external material, or site-relative path (e.g. /resources/…) for published files."
152
+ }
153
+ },
154
+ "required": [
155
+ "title",
156
+ "href"
157
+ ],
158
+ "additionalProperties": false
159
+ }
160
+ }
161
+ }