Link each template in steps that each return what they build, create a name scope with its owner in one place, and settle each record's columns at load, so Generator.records goes

This commit is contained in:
2026-10-05 22:21:10 +02:00
committed by Lillem4n
parent cdc82a99c6
commit cd7f0a04dc
16 changed files with 339 additions and 313 deletions
+5 -4
View File
@@ -93,15 +93,16 @@ func render(s *drawstate.State, n node, sc renderScope) string {
func renderRepeat(s *drawstate.State, t *template, sc renderScope) string {
var b strings.Builder
b.Grow(t.repeat * (t.compiled.grow + len(t.separator)))
own := t.ownScope()
for i := 0; i < t.repeat; i++ {
if i > 0 {
b.WriteString(t.separator)
}
if t.ownNameScope == nil {
if own == nil {
b.WriteString(expand(s, t, sc))
continue
}
mark := sc.frames.push(newPickFrame(t.ownNameScope))
mark := sc.frames.push(newPickFrame(own))
b.WriteString(expand(s, t, sc))
sc.frames.pop(mark)
}
@@ -172,8 +173,8 @@ func renderLeaf(s *drawstate.State, n node, sc renderScope) readValue {
case *nullItem:
return readValue{null: true}
case *template:
if leaf.link.readsColumn != nil {
return readField(s, leaf, sc, leaf.link.readsColumn.a)
if leaf.readsColumn != nil {
return readField(s, leaf, sc, leaf.readsColumn.a)
}
}
return readValue{text: render(s, n, sc)}