One fence sequence over a node scope, and inline templates reject the folder sigils

This commit is contained in:
2026-09-03 20:34:42 +02:00
parent 7c7bee5cd9
commit 80e8d72bb7
5 changed files with 41 additions and 51 deletions
+11 -2
View File
@@ -111,14 +111,23 @@ func linkTemplateRefs(folder []string, path string, t *template, root map[string
}
// linkNodeRefs binds the references in an inline node's templates against the
// loaded tree. The node has no folder of its own, so every sigil is root-relative:
// / and . mean the root, .. has no folder above it.
// loaded tree. An inline template sits in no folder, so . and .. name nothing and
// are rejected for the root spelling they would otherwise silently mean.
func linkNodeRefs(n node, root map[string]node) error {
return eachNode(n, "template", func(path string, m node) error {
t, ok := m.(*template)
if !ok {
return nil
}
for _, name := range refTokens(t.format) {
sigil, rest, err := refShape(name)
if err != nil {
return fmt.Errorf("%s: reference {%s}: %w", path, name, err)
}
if sigil != "/" {
return fmt.Errorf("%s: reference {%s}: an inline template has no folder; write {/%s}", path, name, rest)
}
}
return linkTemplateRefs(nil, path, t, root)
})
}