wiki/asdf.lisp
Render a wiki system, page, or asset into the static site.
Where render-op writes the site for system.
Loading: an Org page becomes a document.
All org-file components of system, in system order.
The DOCUMENTs of system's loaded org files.
Primary names of the systems whose source files the site reads for
definitions and figure mentions. luv-wiki is among them so the site shows
how it renders itself; its tests fabricate figure IDs, which is why
dangling-code-mentions passes over test systems.
Alist of (pathname . system-name) for the cl-source-file components of
every registered system whose primary name is in *CODE-SYSTEMS*, without
loading anything.
One of the code systems, for the source index.
SYSTEM-ENTRYs for the registered code systems, in dependency order:
a system comes after everything it depends on, ties broken by name, and
each source-file of source-files attached to its system.
Alphabetical, but test systems after the rest so the topological pass places them behind their subjects.
Topological order: repeatedly take the first entry whose dependencies are all placed.
The introspected operator lambda lists the renderer reads, if present.
Pathname namestring -> (write-date . source-file), so an unchanged file is not read again within one image.
The SOURCE-FILEs of the code systems, reading a file only when it changed.
The DEFINITIONs of all code source files.
Rendering
A page's rendering depends on the whole system being loaded, since mentions and backlinks resolve across pages.
Every page is an input to every page: a new figure or mention anywhere can change the links and backlinks rendered here; so is every source file, whose definitions may reference this page's figures.
An asset keeps its path relative to its module, so wiki/images/x.png lands at images/x.png in the site.
The system itself contributes the figures index.
The Lisp files the stylesheet is compiled from, so editing a style re-renders the site.
The stylesheet, the figures index, the source index, and one page per source file.
A defsystem form names these classes as strings that ASDF reads in its own package, e.g. :default-component-class "luv.wiki:org-file" and :build-operation "luv.wiki:render-op", so we need not intern anything into the ASDF package.
One Org page of the wiki as an ASDF component.
An open document and the context it was opened in.
Render a wiki system, page, or asset into the static site.
((operation capture-op) (system asdf:system))Headings, paragraphs, figures and their IDs, mentions, marks.
((o render-op))((operation capture-op))((operation capture-op) (system asdf:system))(pathname &key (name (pathname-name pathname)))(system)(system)Primary names of the systems whose source files the site reads for definitions and figure mentions. luv-wiki is among them so the site shows how it renders itself; its tests fabricate figure IDs, which is why DANGLING-CODE-MENTIONS passes over test systems.
(site)An alist of (definition . ids) for code mentions no figure resolves, leaving out the definitions of test systems.
()Alist of (pathname . system-name) for the cl-source-file components of every registered system whose primary name is in *CODE-SYSTEMS*, without loading anything.
One of the code systems, for the source index.
(source-files)SYSTEM-ENTRYs for the registered code systems, in dependency order: a system comes after everything it depends on, ties broken by name, and each SOURCE-FILE of SOURCE-FILES attached to its system.
One Lisp source file of the system as read by luv-wiki.
Logical conjunction of tests and raw truth values.
Logical disjunction of tests and raw truth values.
(system)Pathname namestring -> (write-date . source-file), so an unchanged file is not read again within one image.
(&key (root (uiop:getcwd)))Test whether two compatible scalars are equal.
(pathname &key relative-path system-name)(system)(pathname)(domain x y z &optional (extent +vertex-extent+) (polarity 1))Pack a canonical site inside DOMAIN's box. No coordinate wraps: anchors range over [0, limit] per horizontal axis, and a site extending along an axis cannot begin on that axis's far boundary.
((o render-op) (c org-file))A page's rendering depends on the whole system being loaded, since mentions and backlinks resolve across pages.
((o render-op) (c org-file))Every page is an input to every page: a new figure or mention anywhere can change the links and backlinks rendered here; so is every source file, whose definitions may reference this page's figures.
(&key (code t))(pathname thunk)(document)()The Lisp files the stylesheet is compiled from, so editing a style re-renders the site.
(directory)(site)Emit pages.html: every wiki page with its headings, each a link to its figure, work marks flagged; a dense table.
(site)(site)Emit source.html: the dependency graph of the systems, then one dense table in dependency order — system, description, files — where a file's count opens its definitions in a popover.
(file)(file)Emit the page for FILE: its definitions table and every top-level form as dexp boxes, each anchored by its starting line, with the sidebar of all files beside it on wide screens.
(&rest arguments)(site)(&optional (count "12"))Print COUNT fresh figure IDs that no page uses (default 12); never six hex digits, which the reader takes for a colour.
One top-level defining form of a source file.
(definition)
The wiki as an ASDF system.
ASDF is a build system for Lisp, but its model is general: components have input files, operations have outputs, and the plan is a dependency graph over (operation . component) actions. cffi-toolchain uses that generality to compile C files; here we use it for Org pages.
An
org-fileis a static-file component (so the ordinary compile-op is a no-op) whose LOAD-OP reads the page into adocumentand remembers it on the component. "Loading the wiki" therefore means having the corpus as Lisp objects in the image, ready for the figure index or an inspector.render-opis a downward, selfward operation: rendering the system renders every page; rendering a page first loads it, and also loads the whole system, because mentions and backlinks cross pages. It writes HTML into the site directory rather than the fasl cache, so itsoutput-filesasks not to be translated. A static-file such as an image is simply copied. With :BUILD-OPERATION set, (asdf:make :luv-wiki-site) builds the site.