Keep the vocabulary out of the page a consumer lands on
This commit is contained in:
@@ -861,6 +861,13 @@ the Development section below, and who ships a register the four above then draw
|
||||
a personal instance. Valid while the project wants contribution from outside: the
|
||||
workflow decided nothing, being portable already — `github.api_url` and
|
||||
`secrets.GITHUB_TOKEN` resolve on either host, so only the names moved.
|
||||
- **The vocabulary sits below `doc.go`'s package clause, not in the package doc.**
|
||||
Goal 1 is what a developer choosing a library reads first, and the package doc is
|
||||
that page: a glossary of unexported units would fill two thirds of it with names
|
||||
no consumer can call, and Go doc comments have no code markup, so each one would
|
||||
render its backticks literally. Below the clause it reaches goal 2's reader — who
|
||||
opens the file — and nothing else. Valid while the glossary names units a consumer
|
||||
cannot reach; one that came to name the exported API would belong above the clause.
|
||||
- **Options and fields share one namespace.** `format`, `weight`, `repeat`,
|
||||
`separator`, `datatype` and `drawGroup` are reserved; every other key is a field. Nesting fields under a
|
||||
key, or prefixing options, would tax every template to guard against a
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
// f.Fake("sv_SE.address.locality") // "Sundbyberg": a second call draws afresh
|
||||
//
|
||||
// Several sources merge in order, the last winning a name clash, so custom data
|
||||
// layers over the built-ins. The JSON template format is documented in the README.
|
||||
// layers over the built-ins. The JSON template format is documented in the [README].
|
||||
//
|
||||
// # Vocabulary
|
||||
// [README]: https://github.com/larvit/fejkdata#readme
|
||||
package fejkdata
|
||||
|
||||
// Vocabulary
|
||||
//
|
||||
// The words the rest of the package uses, and the unit that owns each:
|
||||
//
|
||||
@@ -41,4 +44,3 @@
|
||||
// expansion's held names, `drawCheck` over a render's reference paths, and
|
||||
// `checkFamilies` over the rows they pin. `New` runs them over the data set,
|
||||
// `NewTemplate` and `FakeStruct` over what those compile.
|
||||
package fejkdata
|
||||
|
||||
+5
-6
@@ -47,14 +47,13 @@ func sourceFiles(t *testing.T) []*ast.File {
|
||||
func vocabulary(t *testing.T, files []*ast.File) string {
|
||||
t.Helper()
|
||||
for _, f := range files {
|
||||
if f.Doc == nil {
|
||||
continue
|
||||
}
|
||||
if _, section, found := strings.Cut(f.Doc.Text(), "\n# Vocabulary\n"); found {
|
||||
return section
|
||||
for _, c := range f.Comments {
|
||||
if section, found := strings.CutPrefix(c.Text(), "Vocabulary\n"); found {
|
||||
return section
|
||||
}
|
||||
}
|
||||
}
|
||||
t.Fatal("no package doc carries a Vocabulary heading, so fence, hold, pin and the rest are defined nowhere a reader of the code meets them")
|
||||
t.Fatal("no comment opens with a Vocabulary heading, so fence, hold, pin and the rest are defined nowhere a reader of the code meets them")
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user