glossary

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package glossary derives the brief glossary's own index from the term files.

`.abcd/development/brief/glossary/` is the project's one canonical glossary: one Markdown file per term, grouped by bounded context, each carrying the frontmatter the `GL002` forbidden-synonym rule reads (`internal/core/lint`). Its README used to enumerate the contexts and the terms by hand, which is a second copy of what the directory already states — this package makes the directory the source and the README a render of it, so a term file that lands without an index row fails the build instead of going unlisted.

It is transport-agnostic like the rest of `core/`: it reads the working tree and returns strings; nothing here writes to stdout or to the README.

Index

Constants

View Source
const (
	// DirRelPath is the canonical glossary's repo-relative home (adr-30).
	DirRelPath = ".abcd/development/brief/glossary"
	// READMERelPath is the index page that carries the rendered blocks.
	READMERelPath = DirRelPath + "/README.md"

	// LayoutMarkerBegin and LayoutMarkerEnd delimit the rendered directory
	// layout inside the glossary README.
	LayoutMarkerBegin = "<!-- BEGIN GENERATED: glossary-layout -->"
	LayoutMarkerEnd   = "<!-- END GENERATED: glossary-layout -->"

	// IndexMarkerBegin and IndexMarkerEnd delimit the rendered term index
	// inside the glossary README.
	IndexMarkerBegin = "<!-- BEGIN GENERATED: glossary-index -->"
	IndexMarkerEnd   = "<!-- END GENERATED: glossary-index -->"
)

Variables

This section is empty.

Functions

func RenderIndex

func RenderIndex(g Glossary) string

RenderIndex returns the term index — one subsection and table per bounded context — exactly as it appears between the index markers in the README.

func RenderLayout

func RenderLayout(g Glossary) string

RenderLayout returns the glossary's directory layout as a fenced tree, exactly as it appears between the layout markers in the glossary README.

Types

type Context

type Context struct {
	// Name is the directory name, which every member's `bounded_context` matches.
	Name string
	// Files are the context directory's Markdown files, sorted — term files and
	// the context README alike, so the rendered layout matches the directory.
	Files []string
	// Terms are the context's term files, sorted by file name.
	Terms []Term
}

Context is one bounded context: a directory of term files.

type Glossary

type Glossary struct {
	// RootFiles are the Markdown files at the glossary root (the README and the
	// term template), sorted.
	RootFiles []string
	// Contexts are the bounded-context directories, sorted by name.
	Contexts []Context
}

Glossary is the whole glossary as the directory states it.

func Scan

func Scan(repoRoot string) (Glossary, error)

Scan reads the glossary directory and returns what it states. A term file missing the `term`, `status`, or `definition` field is an error, not a silent omission: an unreadable term must not vanish from the index it belongs in.

func ScanInRoot added in v0.8.0

func ScanInRoot(root *os.Root) (Glossary, error)

ScanInRoot is Scan over a repository root a caller already holds open. It is the implementation both forms share: a caller that opens its own root — the site build does, so a committed ancestor symlink cannot walk a read out of the repository — must not pay for a second one, and must not get a second scanner.

type Term

type Term struct {
	// Name is the canonical term, from the `term` field.
	Name string
	// File is the term file's name within its context directory.
	File string
	// Status is the `status` field (draft, stable, or deprecated).
	Status string
	// Definition is the `definition` field, verbatim.
	Definition string
	// Aliases are the `aliases` field's members — the other spellings that mean
	// this term. Absent, null or empty, there are none.
	Aliases []string
}

Term is one term file's index-bearing frontmatter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL