Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
@@ -257,7 +257,7 @@ func checkNodeFences(s nodeScope) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if refs {
|
if refs {
|
||||||
if err := s(checkOwnFamilies); err != nil {
|
if err := s(checkOwnFamily); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s(fence.checkDraws); err != nil {
|
if err := s(fence.checkDraws); err != nil {
|
||||||
|
|||||||
@@ -24,17 +24,6 @@ func (f *drawFence) checkDrawGroup(path string, n node) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkOwnFamilies(path string, n node) error {
|
|
||||||
t, ok := n.(*template)
|
|
||||||
if !ok {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if err := checkOwnFamily(t); err != nil {
|
|
||||||
return fmt.Errorf("%s: %w", path, err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *drawFence) checkDraws(path string, n node) error {
|
func (f *drawFence) checkDraws(path string, n node) error {
|
||||||
t, ok := n.(*template)
|
t, ok := n.(*template)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
+5
-4
@@ -258,11 +258,12 @@ func checkFamilies(reads []pathRead) error {
|
|||||||
// read draws its row without pinning it, so the family would draw apart from the row
|
// read draws its row without pinning it, so the family would draw apart from the row
|
||||||
// it renders, whichever draws the reaching template holds.
|
// it renders, whichever draws the reaching template holds.
|
||||||
// docs/decisions.md#a-table-never-reaches-its-own-family-by-any-route
|
// docs/decisions.md#a-table-never-reaches-its-own-family-by-any-route
|
||||||
func checkOwnFamily(t *template) error {
|
func checkOwnFamily(path string, n node) error {
|
||||||
own := t.site.table
|
t, isTemplate := n.(*template)
|
||||||
if own == nil {
|
if !isTemplate || t.site.table == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
own := t.site.table
|
||||||
seen := map[node]bool{}
|
seen := map[node]bool{}
|
||||||
var find func(n node) (renderEdge, *table, bool)
|
var find func(n node) (renderEdge, *table, bool)
|
||||||
find = func(n node) (renderEdge, *table, bool) {
|
find = func(n node) (renderEdge, *table, bool) {
|
||||||
@@ -283,7 +284,7 @@ func checkOwnFamily(t *template) error {
|
|||||||
return renderEdge{}, nil, false
|
return renderEdge{}, nil, false
|
||||||
}
|
}
|
||||||
if e, familyTable, found := find(t); found {
|
if e, familyTable, found := find(t); found {
|
||||||
return fmt.Errorf("%s reads %s, a table of its own family, which a bare read of %s would draw apart from the row it renders; read the family from a template beside it, or add the value as a column", e.reached(), familyTable.segment, own.segment)
|
return fmt.Errorf("%s: %s reads %s, a table of its own family, which a bare read of %s would draw apart from the row it renders; read the family from a template beside it, or add the value as a column", path, e.reached(), familyTable.segment, own.segment)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user