Split the expansion's hold from the group's, and read a table's row from where the table is entered

This commit is contained in:
2026-09-28 23:09:13 +02:00
committed by Lillem4n
parent 88f762077f
commit 194f194f81
7 changed files with 63 additions and 47 deletions
+3 -5
View File
@@ -33,7 +33,7 @@ func (f *Generator) Fake(path string) (string, error) {
if _, ok := n.(*folder); ok {
return "", fmt.Errorf("fejkdata: %s names a folder, not a value", path)
}
return render(f.rand, n, sc), nil
return render(f.rand, n, sc.at(n, &sc.hold().pins)), nil
}
// descend walks a caller's path to the node it names, pinning in sc the rows it
@@ -56,14 +56,12 @@ func render(s *session, n node, sc renderScope) string {
case *nullItem:
return ""
case *table:
var own pinSet
own.add(n, n.drawRow(s))
sc.pins = &own
sc.row = tablePin{n, n.drawRow(s)}
return expand(s, n.formatTemplate, sc)
case *tableRow:
return expand(s, n.t.formatTemplate, sc)
case *tableColumn:
row := sc.rows().mustRow(n.t)
row := sc.rowOf(n.t)
if cell := n.t.cellTemplate(row, n.i); cell != nil {
return render(s, cell, sc)
}