Render a repeat iteration in no group, refuse a group that names nothing, key group names by category, and own reference overlap in one fence
Tests / vet + fmt + tests (pull_request) Successful in 1m6s

This commit is contained in:
2026-09-15 23:31:48 +02:00
parent f6b8f4fb50
commit d3f430bf53
9 changed files with 203 additions and 106 deletions
+4
View File
@@ -136,6 +136,9 @@ func inputValue(input string) (any, error) {
// bindInline links an inline node's references against root and runs check over it, naming its
// nodes from label.
func bindInline(n node, label string, root map[string]node, check func(nodeScope) error) error {
if t, isTemplate := n.(*template); isTemplate && t.group != "" {
return fmt.Errorf("%s: group %q names nothing, since nothing can reference an inline template; drop it", label, t.group)
}
scope := inlineScope(n, label)
if err := linkNodeRefs(scope, root); err != nil {
return err
@@ -151,6 +154,7 @@ func linkNodeRefs(scope nodeScope, root map[string]node) error {
if !ok {
return nil
}
t.keyGroup("")
for _, name := range refTokens(t.format) {
sigil, rest, err := refShape(name)
if err != nil {