Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33

Open
lilleman wants to merge 966 commits from worktree-todo-relative-dates-exact-counts into main
8 changed files with 27 additions and 24 deletions
Showing only changes of commit 068e2b73ca - Show all commits
+7 -7
View File
@@ -193,7 +193,7 @@ type drawWalk struct {
type drawAt struct {
group string
route drawRoute
pinned pinSet
pins pinSet
drawn *table // left out of the visit keys: only this table's own cells compare against it, which the own-family fence keeps true
whole pinSet
}
@@ -211,13 +211,13 @@ type pathRead struct {
type nodeVisit struct {
n node
group string
rows string
rowsKey string
}
type readKey struct {
group string
path string
rows string
rowsKey string
}
func newDrawWalk() *drawWalk {
@@ -251,16 +251,16 @@ func (w *drawWalk) walk(n node, at drawAt) {
in.whole = at.whole.clone()
in.whole.add(cell.cellOf, cell.cellRow)
w.edge(n, e, in)
case at.pinned.clash(cell.cellOf, cell.cellRow) == nil:
case at.pins.clash(cell.cellOf, cell.cellRow) == nil:
in := at
in.pinned = at.pinned.entered(cell.cellOf, cell.cellRow)
in.pins = at.pins.entered(cell.cellOf, cell.cellRow)
w.edge(n, e, in)
}
}
}
// rowsKey spells the rows the walk stands in, pinned and whole, for a map.
func (at drawAt) rowsKey() string { return at.pinned.key() + "|" + at.whole.key() }
func (at drawAt) rowsKey() string { return at.pins.key() + "|" + at.whole.key() }
// edge records the reference an edge reads, then walks on with every row the read
// pins entered, so a selected row renders only its own cells.
@@ -272,7 +272,7 @@ func (w *drawWalk) edge(from node, e renderEdge, at drawAt) {
w.reads = append(w.reads, pathRead{at, a, tr})
}
if tr != nil {
tr.pins.each(func(t *table, r int) { at.pinned = at.pinned.entered(t, r) })
tr.pins.each(func(t *table, r int) { at.pins = at.pins.entered(t, r) })
}
}
w.walk(e.to, at)
+1 -1
View File
@@ -219,4 +219,4 @@ func checkOwnFamily(t *template) error {
// alternatives reports whether two reads sit in different rows of one table: rows the walks pinned,
// or rows of one whole draw.
// docs/decisions.md#the-rows-of-a-table-are-alternatives
func alternatives(a, b drawAt) bool { return a.pinned.differs(&b.pinned) || a.whole.differs(&b.whole) }
func alternatives(a, b drawAt) bool { return a.pins.differs(&b.pins) || a.whole.differs(&b.whole) }
+1 -1
View File
@@ -68,7 +68,7 @@ func contained(n node) []namedNode {
}
var out []namedNode
for r := 0; r < n.t.rows(); r++ {
if cell := n.t.cellNode(r, n.i); cell != nil {
if cell := n.t.cellTemplate(r, n.i); cell != nil {
out = append(out, namedNode{node: cell})
}
}
+1 -1
View File
@@ -70,7 +70,7 @@ func render(s *session, n node, sc renderScope) string {
if sc.t != n.t {
sc.t, sc.row = n.t, sc.hold().pins.mustRow(n.t)
}
if cell := n.t.cellNode(sc.row, n.i); cell != nil {
if cell := n.t.cellTemplate(sc.row, n.i); cell != nil {
return render(s, cell, sc)
}
return n.t.cell(sc.row, n.i)
+2 -2
View File
@@ -62,9 +62,9 @@ func (t *table) rows() int { return len(t.cells) / len(t.columns) }
func (t *table) cell(row, col int) string { return t.cells[row*len(t.columns)+col] }
// cellNode is what a cell renders: its compiled template where it carries tokens,
// cellTemplate is what a cell renders: its compiled template where it carries tokens,
// else nil for its text.
func (t *table) cellNode(row, col int) *template { return t.cellTemplates[row*len(t.columns)+col] }
func (t *table) cellTemplate(row, col int) *template { return t.cellTemplates[row*len(t.columns)+col] }
// tableOptions are the keys a table object takes; every other key is refused.
var tableOptions = []string{"format", "key", "name", "parent", "rows", "weight"}
+3 -3
View File
@@ -996,11 +996,11 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) {
for cr := 0; cr < cand.rows(); cr++ {
beside := s.clone()
refused := beside.pinRow(cand, cr) != nil
pinned := drawAt{pinned: none.entered(cand, cr)}
if got := alternatives(drawAt{pinned: s}, pinned); got != refused {
candAt := drawAt{pins: none.entered(cand, cr)}
if got := alternatives(drawAt{pins: s}, candAt); got != refused {
t.Errorf("alternatives(%s, %s) = %v, but pinning both refuses = %v", entered.selectorSpelling(row), cand.selectorSpelling(cr), got, refused)
}
if alternatives(whole, pinned) || alternatives(pinned, whole) {
if alternatives(whole, candAt) || alternatives(candAt, whole) {
t.Errorf("%s rendered whole is an alternative to %s pinned, though the whole draw ignores the pin", entered.selectorSpelling(row), cand.selectorSpelling(cr))
}
other := drawAt{drawn: cand}
+3
View File
@@ -19,6 +19,9 @@ Self-sufficiency 5.6), every seat capped by Locality or Self-sufficiency.
This round, in order:
- Hold only the `{token}` grammar's tests in `format_test.go`: move the helpers seven
other test files use (`engine`, `parse`, `compiled`, `mustRender`) and the weight,
recursion and path-navigation tests to files named for what they test.
- Run the nine-seat panel again and file what it names here.
### Data
+1 -1
View File
@@ -103,7 +103,7 @@ func (p *valueProof) cells(c *column) proven {
var v proven
for r := 0; r < c.t.rows(); r++ {
var w proven
if cell := c.t.cellNode(r, c.i); cell != nil {
if cell := c.t.cellTemplate(r, c.i); cell != nil {
w = p.of(cell)
} else {
w = literalValue(c.t.cell(r, c.i))