- rename the two libraries: writeonce-framework -> writeonce-serve
(`use serve`), wo-html -> writeonce-view (`use view`). Names say the
ROLE now; every sample, script, gate and live doc follows
- stories/specs/plans keep the old names: they are dated records, and
both library READMEs carry a "renamed 2026-08-25" note
- serve/http/files.wo: StaticFiles { dir, max_bytes } — traversal
refused not normalised, extension content types, attachment
disposition for archives. Lifted out of the shop, which had said in
a comment that it belonged in the framework
- shop drops its private copy and mounts the framework's
- site: /dl/*path over $WO_DIST (default ./dist), 16 MiB ceiling
- /install gains supported systems — Linux x86-64, glibc >= 2.38,
not musl — read off `file` and the binaries' GLIBC_ symbol
versions, not off a wish list; plus GitHub release as primary,
/dl as mirror, and the sha256 verify step
- site-accept: 17 -> 21 checks (supported systems, gzip download with
a binary-safe probe, checksum, /dl traversal 404)
Verified on 192.168.0.165: the real 960,820-byte tarball downloads
as application/gzip and its sha256 matches the published digest.
Gates: oop-accept MET, site 21/0, web-app 46/0, fibers 10/0,
db-actor 8/0; shop rebuilt and its /assets served by the framework.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
46 lines
1.6 KiB
Text
46 lines
1.6 KiB
Text
-- chapter/view.wo — the VIEW for `/ch/:slug`, plus the chapter nav that
|
|
-- the homepage reuses.
|
|
--
|
|
-- The MVC seam in one place: these components RENDER, the controller
|
|
-- QUERIES, and the two never meet. ChapterNav holds VALUES (a list of
|
|
-- links), so it renders identically on the homepage and on a chapter
|
|
-- page — the only difference is which ord is `current`. Reuse is the
|
|
-- same component with different fields, never copied markup.
|
|
use view
|
|
|
|
-- `ChapterLink` is the MODEL's projection type (types.wo); a class is
|
|
-- reachable across module lines, so the view just names it.
|
|
|
|
pub class ChapterNav {
|
|
items: multi ChapterLink
|
|
current: Int
|
|
|
|
fn render() -> Text {
|
|
let out = "";
|
|
for c in self.items {
|
|
let label = `${c.ord}. {{ c.title }}`;
|
|
if c.ord == self.current {
|
|
out = out .. el("li", "mb-2 font-bold text-gray-900", label);
|
|
} else {
|
|
out = out .. el("li", "mb-2", link("/ch/${c.slug}", "", label));
|
|
}
|
|
}
|
|
return el("ul", "list-disc pl-6", out);
|
|
}
|
|
}
|
|
|
|
-- One chapter. `body` is site-authored HTML held in the row, so it goes
|
|
-- through the RAW hole; the title is data and goes through `{{ }}`.
|
|
pub class ChapterPage {
|
|
ord: Int
|
|
title: Text
|
|
body: Text
|
|
chapter_nav: Component
|
|
|
|
fn render() -> Text {
|
|
let head = el("h1", "text-3xl font-bold mb-4", `${self.ord}. {{ self.title }}`);
|
|
let art = el("div", "bg-white rounded-lg border shadow-sm p-6", head .. self.body);
|
|
let nav = el("div", "mt-8", el("h2", "text-lg font-bold mb-2", "Chapters") .. self.chapter_nav.render());
|
|
return art .. nav;
|
|
}
|
|
}
|