Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v0 state

Back to all declarations

piece

type

piece is one entry in the index. The gallery stores no art. Every piece lives in somebody's realm and this is a pointer to it, which is why there is no package-level state anywhere in this realm and nothing here survives or needs to survive a redeploy.

Value

v0.piece

catalog

func() []v0.piece

catalog is built per call rather than held in a package-level var: a func value is not something to persist, and a realm that stores nothing should not be paying storage for its own index.

Open
OID
0f90c5…f1a1:3
catalog details

Inspect func

find

func(slug string) (v0.piece, bool)
Open
OID
0f90c5…f1a1:5
find details

Inspect func

realmPath

untyped string

realmPath is this realm's own path, version included. gnoweb does NOT resolve an unversioned realm path to its latest version: it serves /r/moul/gallery as a DIRECTORY INDEX and drops the :path and ?query entirely. Measured 2026-09-30 on gnoland-1, where /r/moul/outfmt:?fmt=json renders the index page while /r/moul/outfmt/v0:?fmt=json returns the JSON. So every self-link has to carry the version, and stating it once is what keeps the next one from being written without it. Only r/moul/home and r/moul/blog are genuinely unversioned paths.

Value

"/r/moul/gallery/v0"

banner

func() string

banner is drawn with p/moul/art rather than typed as a string literal, because a gallery that hand-writes its own ASCII would be a poor advert for the library it exists to show.

Open
OID
0f90c5…f1a1:8
banner details

Inspect func

renderIndex

func(text bool) string
Open
OID
0f90c5…f1a1:9
renderIndex details

Inspect func

renderPiece

func(slug string, text bool) string
Open
OID
0f90c5…f1a1:10
renderPiece details

Inspect func

plural

func(n int, word string) string
Open
OID
0f90c5…f1a1:11
plural details

Inspect func

doc

type

doc builds the plain-text target: a document that reads well as-is, rather than markdown with the syntax characters deleted. This is a prototype, deliberately small and deliberately here rather than in a p/ package. Porting one realm is not enough to know what the shared document model should be; porting the fifth will be. What it already pins is the set of rules that make text good instead of merely stripped: 1. A link prints its text inline and collects the URL into a numbered footnote. Never "\[text](url)", which is the single worst thing markdown does to a terminal reader. 2. A heading is underlined, not prefixed with '#'. 3. Art is emitted verbatim: never wrapped, never escaped, never fenced. 4. Prose is wrapped at a fixed width; art and fields are not.

Value

v0.doc

width

untyped bigint

width is where prose wraps. 72 leaves room for a quoting prefix in an email or a diff without re-wrapping.

Value

(72 <untyped> bigint)

joinPadded

func(cells []string, w []int) string

joinPadded pads every cell but the last, which would only add trailing space.

Open
OID
0f90c5…f1a1:13
joinPadded details

Inspect func

wrap

func(s string, w int) string

wrap breaks on spaces at w runes. A word longer than w is left alone rather than cut: a URL or a realm path is worse broken than wide.

Open
OID
0f90c5…f1a1:15
wrap details

Inspect func
piece : type =v0.piece
catalog : func() []v0.piece Inspect
find : func(slug string) (v0.piece, bool) Inspect
realmPath : untyped string ="/r/moul/gallery/v0"
Render : func(path string) string Inspect
banner : func() string Inspect
renderIndex : func(text bool) string Inspect
renderPiece : func(slug string, text bool) string Inspect
plural : func(n int, word string) string Inspect
itoa : func(v int) string Inspect
doc : type =v0.doc
width : untyped bigint =(72 <untyped> bigint)
joinPadded : func(cells []string, w []int) string Inspect
wrap : func(s string, w int) string Inspect
runeLen : func(s string) int Inspect