Documentation
¶
Overview ¶
Package datadep builds docs/data-dependence.md from one file per table row.
Why: all rows used to live in one Markdown table, so two PRs that each added a row conflicted in that file (#1088). Now each row is its own file under docs/data-dependence/<section>/, and this package builds the page from them and a template.
Row file format. It is NOT YAML. The standard library parses it:
--- key: value (one line each; split at the first ": ") order: 30 (optional; sorts rows; default 1000; ties sort by file name) --- The reason, in plain words, on any number of lines. Newlines become spaces in the table.
Index ¶
Constants ¶
const PagePath = "docs/data-dependence.md"
PagePath is the generated page, relative to the repo root.
const RegenCommand = "go run ./cmd/gen-datadep"
RegenCommand is the command that rewrites the page. Tests print it.
Variables ¶
var ( Components = Section{ Dir: "components", Placeholder: "{{component_rows}}", Keys: []string{"name", "kind", "where", "off", "metadata_only", "everything", "decided_by", "order"}, Columns: []string{"name", "kind", "where", "off", "metadata_only", "everything", "reason", "decided_by"}, BacktickName: true, } Features = Section{ Dir: "features", Placeholder: "{{feature_rows}}", Keys: []string{"name", "kind", "off", "metadata_only", "everything", "order"}, Columns: []string{"name", "kind", "off", "metadata_only", "everything", "reason"}, } Sections = []Section{Components, Features} )
Functions ¶
Types ¶
type Row ¶
type Row struct {
File string // path of the file, for messages
Stem string // file name without ".md"
Fields map[string]string
Order int
}
Row is one parsed row file.
type Section ¶
type Section struct {
Dir string // under docs/data-dependence/
Placeholder string // the line in the template that the rows replace
Keys []string // front matter keys, in the order they are allowed to be written
Columns []string // cells, in column order; "reason" is the body; "name" may be wrapped
BacktickName bool // render the name cell as `name`
}
Section describes one table: its directory, and its cells in column order. The key "name" is the first cell. The body of the file is the cell "reason".