Keep reference bindings out of template.fields, in template.refHeads

This commit is contained in:
2026-09-24 13:47:51 +02:00
committed by Lillem4n
parent 84b3252bfc
commit 5aae86638b
13 changed files with 26 additions and 53 deletions
+1 -14
View File
@@ -245,7 +245,7 @@ func recordOf(n node) (*template, []Column, error) {
if !ok {
return nil, nil, errors.New("names a choice, not a template; a record is a template whose fields are its columns")
}
names := recordColumns(t)
names := sortedNames(t.fields)
if len(names) == 0 {
return nil, nil, ErrNoColumns
}
@@ -274,16 +274,3 @@ func renderRecord(s *session, t *template, columns []Column, sc renderScope) *Re
}
return r
}
// recordColumns is the sorted non-reference field names — the columns a record
// projects. A {/path} binding is carried in fields under its root path, so only a
// name that is not a reference is a column.
func recordColumns(t *template) []string {
var names []string
for _, name := range sortedNames(t.fields) {
if !isRef(name) {
names = append(names, name)
}
}
return names
}