Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
@@ -35,6 +35,15 @@ func renderOnce(s *session, n node) string {
|
|||||||
return render(s, n, renderScope{set: &set})
|
return render(s, n, renderScope{set: &set})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// expandAnew expands one repeat iteration of t as a render of its own, in no group. Inlined into
|
||||||
|
// render's loop, its hold set would move to the heap.
|
||||||
|
//
|
||||||
|
//go:noinline
|
||||||
|
func expandAnew(s *session, t *template) string {
|
||||||
|
set := lazyHoldSet(s)
|
||||||
|
return expand(s, t, renderScope{set: &set})
|
||||||
|
}
|
||||||
|
|
||||||
// in is the scope t renders in: its draw group where it names one, else its caller's.
|
// in is the scope t renders in: its draw group where it names one, else its caller's.
|
||||||
func (sc renderScope) in(t *template) renderScope {
|
func (sc renderScope) in(t *template) renderScope {
|
||||||
if t.drawGroupKey != "" {
|
if t.drawGroupKey != "" {
|
||||||
|
|||||||
@@ -96,15 +96,6 @@ func render(s *session, n node, sc renderScope) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// expandAnew expands one repeat iteration of t as a render of its own, in no group. Inlined into
|
|
||||||
// render's loop, its hold set would move to the heap.
|
|
||||||
//
|
|
||||||
//go:noinline
|
|
||||||
func expandAnew(s *session, t *template) string {
|
|
||||||
set := lazyHoldSet(s)
|
|
||||||
return expand(s, t, renderScope{set: &set})
|
|
||||||
}
|
|
||||||
|
|
||||||
// pick selects one item. Uniform choices are O(1); weighted choices are an
|
// pick selects one item. Uniform choices are O(1); weighted choices are an
|
||||||
// O(log n) search over precomputed cumulative weights. compile guarantees a
|
// O(log n) search over precomputed cumulative weights. compile guarantees a
|
||||||
// non-empty choice and a finite positive total, so the index is always in range.
|
// non-empty choice and a finite positive total, so the index is always in range.
|
||||||
|
|||||||
Reference in New Issue
Block a user