diff options
Diffstat (limited to 'tpl/collections')
-rw-r--r-- | tpl/collections/collections.go | 3 | ||||
-rw-r--r-- | tpl/collections/collections_test.go | 8 | ||||
-rw-r--r-- | tpl/collections/init.go | 20 |
3 files changed, 10 insertions, 21 deletions
diff --git a/tpl/collections/collections.go b/tpl/collections/collections.go index 86674f423..0843fb7bc 100644 --- a/tpl/collections/collections.go +++ b/tpl/collections/collections.go @@ -39,9 +39,6 @@ type Namespace struct { deps *deps.Deps } -// Namespace returns a pointer to the current namespace instance. -func (ns *Namespace) Namespace() *Namespace { return ns } - // After returns all the items after the first N in a rangeable list. func (ns *Namespace) After(index interface{}, seq interface{}) (interface{}, error) { if index == nil || seq == nil { diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go index 9d34d3be0..eefbcef6c 100644 --- a/tpl/collections/collections_test.go +++ b/tpl/collections/collections_test.go @@ -29,14 +29,6 @@ import ( type tstNoStringer struct{} -func TestNamespace(t *testing.T) { - t.Parallel() - - ns := New(&deps.Deps{}) - - assert.Equal(t, ns, ns.Namespace(), "object pointers should match") -} - func TestAfter(t *testing.T) { t.Parallel() diff --git a/tpl/collections/init.go b/tpl/collections/init.go index ded7b803c..29f6809c3 100644 --- a/tpl/collections/init.go +++ b/tpl/collections/init.go @@ -25,18 +25,18 @@ func init() { ctx := New(d) examples := [][2]string{ - {`delimit: {{ delimit (slice "A" "B" "C") ", " " and " }}`, `delimit: A, B and C`}, - {`echoParam: {{ echoParam .Params "langCode" }}`, `echoParam: en`}, - {`in: {{ if in "this string contains a substring" "substring" }}Substring found!{{ end }}`, `in: Substring found!`}, + {`{{ delimit (slice "A" "B" "C") ", " " and " }}`, `A, B and C`}, + {`{{ echoParam .Params "langCode" }}`, `en`}, + {`{{ if in "this string contains a substring" "substring" }}Substring found!{{ end }}`, `Substring found!`}, { - `querify 1: {{ (querify "foo" 1 "bar" 2 "baz" "with spaces" "qux" "this&that=those") | safeHTML }}`, - `querify 1: bar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose`}, + `{{ (querify "foo" 1 "bar" 2 "baz" "with spaces" "qux" "this&that=those") | safeHTML }}`, + `bar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose`}, { - `querify 2: <a href="https://www.google.com?{{ (querify "q" "test" "page" 3) | safeURL }}">Search</a>`, - `querify 2: <a href="https://www.google.com?page=3&q=test">Search</a>`}, - {`sort: {{ slice "B" "C" "A" | sort }}`, `sort: [A B C]`}, - {`seq: {{ seq 3 }}`, `seq: [1 2 3]`}, - {`union: {{ union (slice 1 2 3) (slice 3 4 5) }}`, `union: [1 2 3 4 5]`}, + `<a href="https://www.google.com?{{ (querify "q" "test" "page" 3) | safeURL }}">Search</a>`, + `<a href="https://www.google.com?page=3&q=test">Search</a>`}, + {`{{ slice "B" "C" "A" | sort }}`, `[A B C]`}, + {`{{ seq 3 }}`, `[1 2 3]`}, + {`{{ union (slice 1 2 3) (slice 3 4 5) }}`, `[1 2 3 4 5]`}, } return &internal.TemplateFuncsNamespace{ |