Keep reference bindings out of template.fields, in template.refHeads
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user