Documentation
¶
Overview ¶
Package site renders the content tree to a static site (spec 14).
Build writes plain files: HTML pages, the machine copies (.md, .json), the search index, the scene bundles and the assets. A static host serves them. The site works with no script: the script adds the search palette, the code tabs, the theme switch and the player.
Index ¶
- type Badge
- type Base
- type Card
- type Claim
- type Counts
- type DeclView
- type DocPage
- type Fact
- type FileView
- type Group
- type HomePage
- type ImplView
- type Item
- type LangPage
- type LeanView
- type Link
- type ListPage
- type MatrixCell
- type MatrixPage
- type MatrixRow
- type Meta
- type NodePage
- type Options
- type PlayerView
- type ProofView
- type Prop
- type Report
- type RungView
- type SolverRow
- type SourceView
- type Tile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
Title string
Desc string
Path string // the canonical path, for example /merge-sort/
Hue int
Section string // the top bar item that is current
Crumbs []Link
NoIndex bool
Scripts []string
Wide bool
BodyKind string
Meta *Meta
JSONLD template.JS
}
Base is the frame of a page.
type Card ¶
type Card struct {
Solves []Link
Techniques []Link
Implements []Link
Time []Claim
Space []Claim
Other []Claim
Model *Link
Vars []string
Props []Prop
Evidence []Badge
Origin string
}
Card is the summary card of an algorithm, a data structure or a problem (spec 14.7.4).
type Counts ¶
type Counts struct {
Nodes, Algorithms, Structures, Problems, Impls, Langs, Proofs, Scenes, Areas int
}
Counts are the numbers of the home page.
type DeclView ¶ added in v0.1.5
type DeclView struct {
Role string
Name string
Short string // the name without the module namespace
Kind string
Type string
Doc string
Axioms []string
Std bool
Line int
Source string // the lines on GitHub
Proof *Link // the human proof of the same claim, from the lean field of the proof
}
DeclView is one declaration of a Lean module.
type DocPage ¶
type DocPage struct {
Base
Heading string
Lead string
Body template.HTML
TOC []markup.Heading
Source string
}
DocPage is a page of prose.
type ImplView ¶
type ImplView struct {
Lang string
Name string
Tier int
File string
Lines int
HTML template.HTML
Tests []FileView
Rung status.Rung
Test *status.Test
Raw string
GitHub string
Markers template.JS
Selected bool
}
ImplView is one language tab.
type LeanView ¶ added in v0.1.5
type LeanView struct {
Module string
File string // the path in the content repository, such as lean/Algo/Sorting/MergeSort.lean
GitHub string
URL string // the Lean page, /<slug>/lean/
Lines int
HTML template.HTML
Rung status.Rung
// Built is false when the build has no decls.jsonl. Then the page shows the source only.
Built bool
// Std is true when each declaration of the module uses only the standard axioms.
Std bool
// Key holds the declarations that the lean field names, and the class lemmas, in the order of the ladder.
Key []DeclView
// All holds each declaration of the module, in the order of the source.
All []DeclView
}
LeanView is the Lean part of a node: its module, its declarations and the source (spec 07.16, 14.7).
type ListPage ¶
type ListPage struct {
Base
Heading string
Lead string
Facts []Fact
Tiles []Tile
Groups []Group
Empty string
Body template.HTML
}
ListPage is the data of an index page.
type MatrixCell ¶
MatrixCell is one language of a node.
type MatrixPage ¶
MatrixPage is the table of every node by every language.
type MatrixRow ¶
type MatrixRow struct {
Link
H, L, V, W status.Rung
Cells []MatrixCell
}
MatrixRow is one node of the matrix.
type Meta ¶
type Meta struct {
BaseURL string
Version string
Commit string
Short string
Date string
Repo string
AgentURL string
Counts Counts
Year int
}
Meta is the data that every page shares.
type NodePage ¶
type NodePage struct {
Base
N *node.Node
KindName string
Body template.HTML
TOC []markup.Heading
Status status.Status
Rungs []RungView
Card *Card
Prereqs []Link
Leads []Link
Related []Link
Solvers []SolverRow
Impls []ImplView
Proofs []ProofView
Lean *LeanView
Player *PlayerView
Sources []SourceView
Edit string
History string
Report string
Tests string // the summary line of the native tests
}
NodePage is the data of a node page.
type Options ¶
type Options struct {
Out string // the output directory; Build empties it first
BaseURL string // for example https://algorithm.tamnd.com
Results string // the directory of the test results, build/results
Decls string // the declarations of the Lean package, build/lean/decls.jsonl
SpecDir string // a directory of the specification to publish at /spec/, or "" for the copy in the binary
Version string // the version of algo
Commit string // the commit of the content
Repo string // for example https://github.com/tamnd/algorithm
AgentURL string // for example https://github.com/tamnd/algorithm-agent
Minify bool
// Now is the build time. A zero time means time.Now.
Now time.Time
// Log gets one line for each problem that does not stop the build.
Log func(format string, args ...any)
}
Options control a build.
type PlayerView ¶
type PlayerView struct {
Slug string
Script string
Presets template.JS
Input template.JS
Pseudo template.HTML
Full string
}
PlayerView is the data of the player.
type Report ¶
type Report struct {
Pages int
Files int
Bytes int64
MathErrors []string
Scenes map[string]viz.Report
}
Report is what a build made.
type SourceView ¶
SourceView is one entry of Further reading.