Put the reference write beside fields, and cut the header restatement

This commit is contained in:
2026-09-21 11:17:57 +02:00
committed by Lillem4n
parent dda470dc9c
commit a2074a455e
+5 -6
View File
@@ -43,13 +43,13 @@ func (*null) isNode() {}
// that many times and joins the results with separator (default ""), each render // that many times and joins the results with separator (default ""), each render
// an independent pick. // an independent pick.
// //
// Each group below names the pass that fills it. What `template.compileFormat` // What `template.compileFormat` fills is final only once `linkTemplateRefs` has
// fills is final only once `linkTemplateRefs` has run: where the format holds a // run: where the format holds a reference, that binds it and compiles the format
// reference, that binds it and compiles the format again. // again.
type template struct { type template struct {
// Filled by `compileString`, `compileTemplate` and `table.compileFormat`: // Filled by `compileString`, `compileTemplate` and `table.compileFormat`:
format string format string
fields map[string]node fields map[string]node // `linkTemplateRefs` adds each bound reference here
repeat int repeat int
separator string separator string
datatype DataType datatype DataType
@@ -76,8 +76,7 @@ type template struct {
held map[string]bool held map[string]bool
heldLocal bool // some held name is kept by the expansion itself, so expand makes its draws heldLocal bool // some held name is kept by the expansion itself, so expand makes its draws
// Filled by `linkTemplateRefs` and `keyDrawGroup` from the assembled tree; // Filled by `linkTemplateRefs` and `keyDrawGroup`, from the assembled tree:
// `linkTemplateRefs` adds each bound reference to `template.fields` too:
refs map[string]refBinding // each reference the format reads -> what it is bound to refs map[string]refBinding // each reference the format reads -> what it is bound to
readsColumn *columnRead // set when the format is one reference alone reading a record's column readsColumn *columnRead // set when the format is one reference alone reading a record's column
drawGroupKey string // its draw group keyed by its category: what a render reads its reference paths under drawGroupKey string // its draw group keyed by its category: what a render reads its reference paths under