Documentation
¶
Overview ¶
Package glossary writes the term files under term/ and generates GLOSSARY.md from them. Nothing here touches disk: every function returns bytes for a caller in cmd to write, so the rule that nothing under internal/ performs IO on the user's behalf holds here as it does everywhere else.
Index ¶
- Constants
- func Add(r *repo.Repo, term, definition, namedBy string) (docPath string, source []byte, err error)
- func Generate(r *repo.Repo) []byte
- func PathOf(term string) string
- func Remove(r *repo.Repo, term string, frozen func(*repo.Document) bool) (docPath string, err error)
- func Rename(r *repo.Repo, from, to string) (oldPath, newPath string, source []byte, err error)
Constants ¶
const File = "GLOSSARY.md"
File is the generated glossary, written under root beside INDEX.md.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add builds the file for a new term. It refuses a term whose slug is already taken, which covers a name differing only in case: Anchor lowercases, so both would compete for one anchor in GLOSSARY.md and which kept it would depend on document order.
func Generate ¶ added in v0.5.0
Generate renders GLOSSARY.md from the term files. Every former name gets an explicit anchor before its heading, so a link written before a rename still resolves; L17 checks exactly that, and AnchorsIn reads explicit anchors for this reason.
func PathOf ¶ added in v0.5.0
PathOf is the file a term lives in, relative to root and slash-separated. The slug is the identity, which is why two terms that slug alike cannot both exist: they would be one file on a case-insensitive filesystem and one anchor in the generated page either way.
func Remove ¶
func Remove(r *repo.Repo, term string, frozen func(*repo.Document) bool) (docPath string, err error)
Remove reports the file to delete. frozen answers whether a document may no longer be edited; a term a frozen document links to cannot be removed, because the link would be left pointing at an anchor that no longer exists and the document holding it could never be corrected. renumber refuses on the same grounds.
Types ¶
This section is empty.