Documentation
¶
Overview ¶
Package document reads a file as a document (GLOSSARY.md): its type, title, tags and date, and the document rules it breaks. read and write both see documents through it, so they agree on what a document says.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Doc ¶
type Doc struct {
Frontmatter *vault.Frontmatter
Type string // "" for a plain file, which no rule applies to
Title string // the title field
Tags []string
DateField string // the type's date field, or date for a type not configured
Date time.Time // zero when DateField has no value or holds no date
Findings []Finding // in rule order: type, required, date, tag
}
Doc is a file with frontmatter, read as a document.
func Parse ¶
Parse reads src as a document. It returns nil, nil for a file without frontmatter, and the *vault.FrontmatterError for frontmatter that does not parse. A nil vocabulary skips the tag rule.
func Read ¶
func Read(fm *vault.Frontmatter, cfg *config.Config, voc *vault.Vocabulary) *Doc
Read reads parsed frontmatter as a document. A nil vocabulary skips the tag rule.
type Finding ¶
Finding is a document rule a document breaks. Reason says what is wrong; the caller adds what to do next.
type Key ¶
type Key struct{ Type, Field, Value string }
Key is what a Finding is about, as far as its rule tells findings apart: the type for RuleType; the type and field for RuleRequired; the type, field and value for RuleDate; and the tag, as Value, for RuleTag. So a changed type makes its required and date findings new, and an old bad tag stays the same finding.