wiki/html.lisp
The whole wiki corpus and its disposable derived indexes.
Build a site over documents and index their figures and mentions.
The best definition for the bare symbol name: a defining form of the
generic, function, macro, or class before any method, else the first.
Is definition in a file of a test system? Tests fabricate figure IDs
to exercise the reader, so their mentions are not expected to resolve.
An alist of (definition . ids) for code mentions no figure resolves, leaving out the definitions of test systems.
The href for figure id from the page from (a document), or NIL if dangling.
Call function on every inline object reachable from block element,
including headings' titles and table cells, but not into subheadings.
IDs referred to in heading's own section text, not its subheadings.
All figure IDs mentioned anywhere in document, in document order.
An alist of (document . ids) for mentions no figure in site resolves.
Rendering
NIL
The relative path from the page being rendered back to the site root, "" for top-level pages and "../" or deeper for source pages.
Emit Spinneret markup for element into SPINNERET:*html*. Strings are
plain text; each element and inline class contributes its own method.
Spinneret passes the value of every body form to SPINNERET:HTML, whose default method still emits a pending space for a non-NIL object. Rendering is for effect only, so return nothing.
SPINNERET:HTML is Spinneret's own generic for writing an object as escaped text; a bare form at the top of WITH-HTML is not printed.
A paragraph containing only media is a figure of its own.
A single paragraph item renders inline; richer items keep blocks.
Mermaid draws these at load time; the text remains readable.
Transclude a generated image or video without requiring its bytes at build time.
True for a bare file: link to an image inside the wiki directory.
The definition a lisp: link names, or NIL.
A disclosure block: the definition's head, file, and source link as the summary, and the form drawn as dexp boxes inside.
A bare #X reads like the light mention #X.
The breadcrumb trail of the status bar: crumbs is a list of (label . href),
the last one the current page, its href ignored.
Emit a whole HTML page with the site chrome around the output of body:
the library band with the site's three doors, a status bar with the page's
breadcrumb trail on the left and right (a string, or a function emitting
markup) on the right, the main column, and a footer.
While a page renders: a hash table from definition to its card id, filled
by every definition link drawn on the page.
Register definition for a card on the current page and return the id.
The documentation string of definition's form as plain text, or NIL: the
first string among the arguments after the head, or the value after
:documentation.
(:documentation "...") as a DEFCLASS or DEFGENERIC option.
The lambda list of definition as written in the source, or NIL.
Emit hidden cards for the definitions linked on this page.
The opening prose of figure's own section as plain text: paragraphs and
list items in order until about limit characters, cut at a word boundary.
Emit hidden cards for the figures ids, which the page's script shows as
popovers when a mention is hovered or tapped.
Emit the whole HTML page for document.
Code references shown on this page mention figures too.
Emit pages.html: every wiki page with its headings, each a link to its figure, work marks flagged; a dense table.
Every page of the wiki with its headings. Each heading is a figure with a stable ID; work marks carry their status.
Emit work.html: the work marks by status, each with its page and intent.
The work marks of the wiki: figures whose title starts with a status word. They live beside the design they move; this is only a view.
Call thunk with Spinneret writing exact, compact HTML to stream. The
pretty printer would fill text and insert spaces between dynamically written
strings, turning *figure* into "figure "; the wiki's text carries its own
spacing, so both are turned off.
Compile the style definitions and write them as style.css in directory.
Write every page of site, the figures index, and, unless stylesheet is
NIL, the compiled stylesheet into directory.
(&key (code t))(element)Emit Spinneret markup for ELEMENT into SPINNERET:*HTML*. Strings are plain text; each element and inline class contributes its own method.
Code references and lisp: definition blocks.
(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.
An open document and the context it was opened in.
(&rest ids)(document)((heading heading))(heading)(definitions)One top-level defining form of a source file.
(name)(name &optional (site *site*))The best definition for the bare symbol NAME: a defining form of the generic, function, macro, or class before any method, else the first.
Logical conjunction of tests and raw truth values.
Logical disjunction of tests and raw truth values.
(definition site)Is DEFINITION in a file of a test system? Tests fabricate figure IDs to exercise the reader, so their mentions are not expected to resolve.
(definition &optional (site *site*))(site)An alist of (definition . ids) for code mentions no figure resolves, leaving out the definitions of test systems.
(&rest arguments)Test whether two compatible scalars are equal.
Logical negation of one test or raw truth value.
(id &optional (site *site*))(document)(id &key (site *site*) from)(function element)Call FUNCTION on every inline object reachable from block ELEMENT, including headings' titles and table cells, but not into subheadings.
A block-level piece of an Org document.
Emphasized text; VERBATIM and CODE hold one string child.
An Org bracket link.
An Org headline with its section and subheadings.
A run of prose; CHILDREN are inline objects.
A simple Org table without formulas.
(&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.
(document)(site)The document whose page is being rendered; makes same-page links relative.
(inlines)(line)(link)(link)(link)(definition &key open)A disclosure block: the definition's head, file, and source link as the summary, and the form drawn as dexp boxes inside.
A bulleted or numbered list of LIST-ITEMs.
One list item; CHILDREN are blocks, usually a paragraph.
A #+begin_example block, kept verbatim.
A #+begin_src block with its language.
(text &key package)Read TEXT and render it structurally; on any failure fall back to a plain <pre>, so a page never loses its code.
HTML tag and optional class for each emphasis kind.
Inline $...$ or \(...\) math, or display \[...\] and $$...$$.
A light #ID reference to a figure: a hash and six capitals or digits.
(inlines)(protocol link)The href to use for LINK whose scheme is PROTOCOL (a keyword or NIL), or NIL when the link cannot be resolved into the site.
Headings, paragraphs, figures and their IDs, mentions, marks.
(prefix string &key (start 0))Test whether one compatible scalar is greater than another.
Subtraction or unary negation.
(name definitions &key kind)The first definition whose name matches NAME, case-insensitively, with or without a package prefix on either side.
(definition)(definition &optional (site *site*))The href of DEFINITION's line in its source page, or NIL when the site has no page for its file.
(definition)(nodes &key package)(heading)(crumbs)The breadcrumb trail of the status bar: CRUMBS is a list of (label . href), the last one the current page, its href ignored.
(title body &key body-class (kind *page-kind*)
(crumbs (list (cons title nil))) (right kind))Emit a whole HTML page with the site chrome around the output of BODY: the library band with the site's three doors, a status bar with the page's breadcrumb trail on the left and RIGHT (a string, or a function emitting markup) on the right, the main column, and a footer.
While a page renders: a hash table from DEFINITION to its card id, filled by every definition link drawn on the page.
(definition)(definition)The documentation string of DEFINITION's form as plain text, or NIL: the first string among the arguments after the head, or the value after :documentation.
Anything in a stylesheet: a declaration, rule, at-rule, or style group.
A symbol token; nothing is interned.
A parenthesized list; CHILDREN are nodes in order.
(string)The characters of a string literal STRING, without the quotes and with \" and \\ escapes undone.
A ; or #| |# comment, TEXT included.
(definition)(figure &optional (limit 320))The opening prose of FIGURE's own section as plain text: paragraphs and list items in order until about LIMIT characters, cut at a word boundary.
Test whether one compatible scalar is at most another.
(ids)Emit hidden cards for the figures IDS, which the page's script shows as popovers when a mention is hovered or tapped.
(document)((document document))(site)Emit pages.html: every wiki page with its headings, each a link to its figure, work marks flagged; a dense table.
(site)(&rest statuses)(stream thunk)Call THUNK with Spinneret writing exact, compact HTML to STREAM. The pretty printer would fill text and insert spaces between dynamically written strings, turning *figure* into "figure "; the wiki's text carries its own spacing, so both are turned off.
(document &optional (site *site*))(pathname thunk)(directory)(&optional (styles *styles*))(site directory &key (stylesheet t))Write every page of SITE, the figures index, and, unless STYLESHEET is NIL, the compiled stylesheet into DIRECTORY.
(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.
Rendering the wiki corpus as a static HTML site with Spinneret.
A
siteholds every document of the corpus together with the figure index derived from their headings: which page owns each ID, and which figures mention which.render-htmlis the generic that emits Spinneret markup for an element while*SITE*supplies cross-page resolution.