master @ 41 LINES
[ HISTORY ] [ UP ]
┌─ ASTRO ────────────────────────────────────────────────────────────────────┐
│ --- │
│ import { getCollection } from "astro:content"; │
│ import ArticleLayout from "../../layouts/ArticleLayout/ArticleLayout.astro"; │
│ import TopHeader from "../../components/TopHeader/TopHeader.astro"; │
│ import Frame from "../../components/Frame/Frame.astro"; │
│ import Pre from "../../components/Pre/Pre.astro"; │
│ import Tree from "../../components/Tree/Tree.astro"; │
│ import KeyValue from "../../components/KeyValue/KeyValue.astro"; │
│ import ArticleFooter from "../../components/ArticleFooter/ArticleFooter.astro"; │
│ import { ruleD, row2 } from "../../lib/ascii"; │
│ import { published } from "../../lib/notes"; │
│ import { docsTree } from "../../lib/docs"; │
│ import { readManifests, registerOf, type Register } from "../../lib/registers"; │
│ │
│ const entries = await getCollection("kb", published); │
│ const manifests = readManifests(); │
│ const counts: Record<Register, number> = { notes: 0, docs: 0, reference: 0 }; │
│ for (const e of entries) counts[registerOf(e.id, manifests).register]++; │
│ │
│ const tree = docsTree( │
│ entries.map((e) => ({ id: e.id, title: e.data.title, order: e.data.order })), │
│ undefined, │
│ "/kb/", │
│ ); │
│ --- │
│ <ArticleLayout title="OOKNET KB - Knowledge base" │
│ description="The ooknet knowledge base - notes, documentation, and references, o │
│ ne tree."> │
│ <TopHeader /> │
│ <Frame build={(w) => [row2("OOKNET KNOWLEDGE BASE", `${entries.length} ON FILE`, │
│ w), ruleD(w)].join("\n")} /> │
│ <Pre>{" "}</Pre> │
│ <KeyValue entries={[ │
│ ["NOTES", `${counts.notes}`], │
│ ["DOCS", `${counts.docs}`], │
│ ["REFERENCE", `${counts.reference}`], │
│ ]} /> │
│ <Pre>{" "}</Pre> │
│ <Tree nodes={tree} /> │
│ <Pre>{" "}</Pre> │
│ <ArticleFooter /> │
│ </ArticleLayout> │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ASTRO ──────────────────────────────┐
│ --- │
│ import { getCollection } from "astro:content │
│ "; │
│ import ArticleLayout from "../../layouts/Art │
│ icleLayout/ArticleLayout.astro"; │
│ import TopHeader from "../../components/TopH │
│ eader/TopHeader.astro"; │
│ import Frame from "../../components/Frame/Fr │
│ ame.astro"; │
│ import Pre from "../../components/Pre/Pre.as │
│ tro"; │
│ import Tree from "../../components/Tree/Tree │
│ .astro"; │
│ import KeyValue from "../../components/KeyVa │
│ lue/KeyValue.astro"; │
│ import ArticleFooter from "../../components/ │
│ ArticleFooter/ArticleFooter.astro"; │
│ import { ruleD, row2 } from "../../lib/ascii │
│ "; │
│ import { published } from "../../lib/notes"; │
│ import { docsTree } from "../../lib/docs"; │
│ import { readManifests, registerOf, type Reg │
│ ister } from "../../lib/registers"; │
│ │
│ const entries = await getCollection("kb", pu │
│ blished); │
│ const manifests = readManifests(); │
│ const counts: Record<Register, number> = { n │
│ otes: 0, docs: 0, reference: 0 }; │
│ for (const e of entries) counts[registerOf(e │
│ .id, manifests).register]++; │
│ │
│ const tree = docsTree( │
│ entries.map((e) => ({ id: e.id, title: e.d │
│ ata.title, order: e.data.order })), │
│ undefined, │
│ "/kb/", │
│ ); │
│ --- │
│ <ArticleLayout title="OOKNET KB - Knowledge │
│ base" │
│ description="The ooknet knowledge base - n │
│ otes, documentation, and references, one tre │
│ e."> │
│ <TopHeader /> │
│ <Frame build={(w) => [row2("OOKNET KNOWLED │
│ GE BASE", `${entries.length} ON FILE`, w), r │
│ uleD(w)].join("\n")} /> │
│ <Pre>{" "}</Pre> │
│ <KeyValue entries={[ │
│ ["NOTES", `${counts.notes}`], │
│ ["DOCS", `${counts.docs}`], │
│ ["REFERENCE", `${counts.reference}`], │
│ ]} /> │
│ <Pre>{" "}</Pre> │
│ <Tree nodes={tree} /> │
│ <Pre>{" "}</Pre> │
│ <ArticleFooter /> │
│ </ArticleLayout> │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET