Skip to content

Commit dc3689e

Browse files
committed
twin-index draft gives a new contributed landing page its TWINSERV publisher, which the workflow writes as its Author line
1 parent 85d4300 commit dc3689e

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎indexer/draft/workflow.mjs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ function listsPrompt(pkg) {
128128
? `The section has no landing page yet. Write ${landing.file} first: frontmatter \`title: ${landing.title}\`` +
129129
(landing.parent ? `, \`parent: ${landing.parent}\`` : ', the parent the landing pages beside it use') +
130130
(landing.permalink ? `, \`permalink: ${landing.permalink}\`` : ', a permalink of the form the landing pages beside it use') +
131-
`, \`has_toc: false\` and \`indexed_from: ${pkg.version}\`; a short description of the package from its sources (the \`source\` paths in the plan); then the lists. Model it on a landing page of another section in the same folder.\n\n`
131+
`, \`has_toc: false\` and \`indexed_from: ${pkg.version}\`; ` +
132+
(landing.author
133+
? `under the H1, the line \`**Author:** ${landing.author}\`, or the author the package's sources name if they name someone else (WIP.md, the contributed packages); `
134+
: '') +
135+
`a short description of the package from its sources (the \`source\` paths in the plan); then the lists, with no \`* TOC\` list when the page has only one or two sections. Model it on a landing page of another section in the same folder.\n\n`
132136
: ''
133137
return `Bring the lists of the ${pkg.package} section up to date with the pages just drafted for it.
134138

‎indexer/lib/draft-plan.mjs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ function mostCommon(values, fallback) {
9292
* - `sectionDir`, `sourceDir`: the section's folder and the package's sources
9393
* in the store, relative to the repository, with `/`.
9494
* - `newLanding`: for a section with no landing page yet, the `{ title,
95-
* parent, permalink }` it is to get; the returned `landing` then says
96-
* `new: true`.
95+
* parent, permalink }` it is to get, and for a contributed package its
96+
* `author`; the returned `landing` then says `new: true`.
9797
*
9898
* Returns `{ package, group, mode, version, sectionDir, landing, permalinks,
9999
* tasks, unplaced, flagged }`. Each of `tasks` names the page `file`
@@ -351,6 +351,7 @@ export function planPackage({ report, api, pages, sectionDir, sourceDir, newLand
351351
parent: landing.parent ?? null,
352352
permalink: landing.permalink ?? null,
353353
new: !!landing.new,
354+
author: landing.author ?? null,
354355
}
355356
: null,
356357
permalinks,

‎indexer/twin-index.mjs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,11 @@ async function runDraft(filter) {
822822
if (landing) siblings.push({ folder: path.basename(dir), ...landing });
823823
}
824824
newLanding = newLandingFor(report.package, siblings);
825+
// A contributed package's landing page opens with its author: the publisher TWINSERV lists.
826+
if (report.group === "contributed") {
827+
const listed = Object.values((await readManifest("contributed"))?.packages ?? {});
828+
newLanding.author = listed.find((p) => p.symbol === report.package)?.publisher ?? null;
829+
}
825830
}
826831
const storeDir = path.join(STORE_PATH, report.group, report.package);
827832
const api = JSON.parse(await fs.readFile(path.join(storeDir, "api.json"), "utf-8"));

‎test/indexer.test.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,14 +1852,15 @@ describe("planning the pages of a report", () => {
18521852
pages: [],
18531853
sectionDir: "docs/New",
18541854
sourceDir: "s",
1855-
newLanding: newLandingFor("New", [sibling("A")]),
1855+
newLanding: { ...newLandingFor("New", [sibling("A")]), author: "Someone" },
18561856
});
18571857
assert.deepEqual(fresh.landing, {
18581858
file: "docs/New/index.md",
18591859
title: "New Package",
18601860
parent: "Contributed Packages",
18611861
permalink: "/tB/Packages/Contributed/New/",
18621862
new: true,
1863+
author: "Someone",
18631864
});
18641865
assert.equal(fresh.tasks[0].file, "docs/New/Gadget.md");
18651866
assert.equal(fresh.tasks[0].parent, "New Package");

0 commit comments

Comments
 (0)