Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
@@ -13,7 +13,6 @@ import (
|
|||||||
type arm struct {
|
type arm struct {
|
||||||
spelling string // as written, for messages
|
spelling string // as written, for messages
|
||||||
head string
|
head string
|
||||||
writtenHead string // head as written, sigil included
|
|
||||||
tail []string
|
tail []string
|
||||||
levels []pickKey // the key of each level the steps pass, from the head they start at to the leaf; a step's at indexes it
|
levels []pickKey // the key of each level the steps pass, from the head they start at to the leaf; a step's at indexes it
|
||||||
steps []pathStep
|
steps []pathStep
|
||||||
@@ -42,19 +41,17 @@ func splitArm(name string, refs map[string]resolvedRef) arm {
|
|||||||
}
|
}
|
||||||
return arm{spelling: name, head: head, levels: []pickKey{pickKey(head)}}
|
return arm{spelling: name, head: head, levels: []pickKey{pickKey(head)}}
|
||||||
}
|
}
|
||||||
sigil, rest, _ := grammar.RefShape(name) // resolveRefs proved it, and took r.tail as a suffix of its segments
|
return pathArm(name, r.head, r.tail)
|
||||||
written, _ := grammar.SplitPath(rest)
|
|
||||||
return pathArm(name, r.head, sigil+grammar.JoinSegments(written[:len(written)-len(r.tail)]), r.tail)
|
|
||||||
}
|
}
|
||||||
segs, err := grammar.SplitPath(name)
|
segs, err := grammar.SplitPath(name)
|
||||||
if err != nil || len(segs) == 1 {
|
if err != nil || len(segs) == 1 {
|
||||||
return arm{spelling: name, head: name, levels: []pickKey{pickKey(name)}}
|
return arm{spelling: name, head: name, levels: []pickKey{pickKey(name)}}
|
||||||
}
|
}
|
||||||
return pathArm(name, segs[0], segs[0], segs[1:])
|
return pathArm(name, segs[0], segs[1:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func pathArm(name, head, writtenHead string, segs []string) arm {
|
func pathArm(name, head string, segs []string) arm {
|
||||||
return arm{spelling: name, head: head, writtenHead: writtenHead, tail: segs, levels: levelKeys(append([]string{head}, segs...), 1)}
|
return arm{spelling: name, head: head, tail: segs, levels: levelKeys(append([]string{head}, segs...), 1)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// levelKeys is the key of each prefix of path holding at least from segments, shortest first.
|
// levelKeys is the key of each prefix of path holding at least from segments, shortest first.
|
||||||
|
|||||||
Reference in New Issue
Block a user