host: type pages are self-documenting — definition + POPULATION
Every type post reads as schema + extension. Added host/blog--type-population (host/blog--take helper): a type's page shows its instances (posts is-a it, first 24 + count) and its subtypes (is-a / subtype-of inverses), next to the read-only type definition. Injected in host/blog-post when host/blog--is-type?. So /article/ shows what an article IS *and* which posts are articles; /card/ shows its subtypes; every card type / tag / type reads its own definition (all are is-type?). blog 194/194 (+ tests: population lists instances + count, a parent type lists subtypes, GET /article/ shows Population). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1050,6 +1050,18 @@
|
||||
(list (contains? (dream-resp-body (host-bl-app (host-bl-req "/article/"))) "Type definition")
|
||||
(contains? (dream-resp-body (host-bl-app (host-bl-req "/my-first-post/"))) "Type definition"))
|
||||
(list true false))
|
||||
;; a type's page shows its POPULATION too — instances (is-a) + subtypes (schema + extension).
|
||||
(host-bl-test "the type-population section lists a type's instances + count"
|
||||
(begin
|
||||
(host/blog-put! "pop-inst" "PopInst" "(article (h1 \"x\"))" "published")
|
||||
(host/blog-relate! "pop-inst" "article" "is-a")
|
||||
(let ((html (render-page (host/blog--type-population "article"))))
|
||||
(list (contains? html "Population") (contains? html "pop-inst") (contains? html "instance"))))
|
||||
(list true true true))
|
||||
(host-bl-test "a parent type's population lists its subtypes"
|
||||
(contains? (render-page (host/blog--type-population "card")) "Subtypes") true)
|
||||
(host-bl-test "GET /article/ shows the Population section"
|
||||
(contains? (dream-resp-body (host-bl-app (host-bl-req "/article/"))) "Population") true)
|
||||
;; the editor renders a HAND-AUTHORED composition (text/row/alt-with-text) WITHOUT falling
|
||||
;; through to "(unknown block)" — every node kind gets a labelled row (the compose-demo case).
|
||||
(host-bl-test "the block editor renders text/layout/inline-alt nodes (no unknown block)"
|
||||
|
||||
Reference in New Issue
Block a user