tpl/collections: Make it a package that stands on its own
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 30 Apr 2017 19:52:56 +0000 (21:52 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 1 May 2017 13:13:41 +0000 (15:13 +0200)
See #3042

15 files changed:
deps/deps.go
hugolib/alias.go
hugolib/hugo_sites_build.go
hugolib/page.go
hugolib/shortcode.go
hugolib/site.go
tpl/collections/apply.go
tpl/collections/apply_test.go
tpl/collections/collections.go
tpl/collections/init.go [new file with mode: 0644]
tpl/template.go
tpl/tplimpl/template.go
tpl/tplimpl/templateFuncster.go
tpl/tplimpl/template_funcs.go
tpl/tplimpl/template_funcs_test.go

index 99763c115a965611a50d5b0dc92b4351b7de2c09..5f016c4d751673d980c058f7ab55acd36f049e4f 100644 (file)
@@ -20,8 +20,8 @@ type Deps struct {
        // The logger to use.
        Log *jww.Notepad `json:"-"`
 
-       // The templates to use.
-       Tmpl tpl.TemplateHandler `json:"-"`
+       // The templates to use. This will usually implement the full tpl.TemplateHandler.
+       Tmpl tpl.TemplateFinder `json:"-"`
 
        // The file systems to use.
        Fs *hugofs.Fs `json:"-"`
@@ -55,6 +55,10 @@ type ResourceProvider interface {
        Clone(deps *Deps) error
 }
 
+func (d *Deps) TemplateHandler() tpl.TemplateHandler {
+       return d.Tmpl.(tpl.TemplateHandler)
+}
+
 func (d *Deps) LoadResources() error {
        // Note that the translations need to be loaded before the templates.
        if err := d.translationProvider.Update(d); err != nil {
@@ -64,7 +68,10 @@ func (d *Deps) LoadResources() error {
        if err := d.templateProvider.Update(d); err != nil {
                return err
        }
-       d.Tmpl.PrintErrors()
+
+       if th, ok := d.Tmpl.(tpl.TemplateHandler); ok {
+               th.PrintErrors()
+       }
 
        return nil
 }
index d1a1b5534c9d8fd913f4fcaf2e1e6ec39dc86274..20be7c7329dca4bfa426c24586404ca010300ab7 100644 (file)
@@ -44,12 +44,12 @@ func init() {
 }
 
 type aliasHandler struct {
-       t         tpl.TemplateHandler
+       t         tpl.TemplateFinder
        log       *jww.Notepad
        allowRoot bool
 }
 
-func newAliasHandler(t tpl.TemplateHandler, l *jww.Notepad, allowRoot bool) aliasHandler {
+func newAliasHandler(t tpl.TemplateFinder, l *jww.Notepad, allowRoot bool) aliasHandler {
        return aliasHandler{t, l, allowRoot}
 }
 
index e694ab52f2e190eb54cc6f438a732a8222b52432..58088fd7cae4be7d2cc98a00c6695c33d0c22e1c 100644 (file)
@@ -111,7 +111,7 @@ func (h *HugoSites) initRebuild(config *BuildCfg) error {
                // This is for the non-renderable content pages (rarely used, I guess).
                // We could maybe detect if this is really needed, but it should be
                // pretty fast.
-               h.Tmpl.RebuildClone()
+               h.TemplateHandler().RebuildClone()
        }
 
        for _, s := range h.Sites {
index 1e9c06af74be114c12ac2739f4d36126892449a2..bed2e254e525cb1cf1d493f5e0cd06122f6957b9 100644 (file)
@@ -1389,7 +1389,7 @@ func (p *Page) prepareLayouts() error {
        if p.Kind == KindPage {
                if !p.IsRenderable() {
                        self := "__" + p.UniqueID()
-                       err := p.s.Tmpl.AddLateTemplate(self, string(p.Content))
+                       err := p.s.TemplateHandler().AddLateTemplate(self, string(p.Content))
                        if err != nil {
                                return err
                        }
index d72a96faafe3f7f6948c9d3bc9cd23cbfb14ab05..01beffe2bea214edbf2cfaf5360e8c34483cf607 100644 (file)
@@ -565,7 +565,7 @@ func replaceShortcodeTokens(source []byte, prefix string, replacements map[strin
        return source, nil
 }
 
-func getShortcodeTemplate(name string, t tpl.TemplateHandler) *tpl.TemplateAdapter {
+func getShortcodeTemplate(name string, t tpl.TemplateFinder) *tpl.TemplateAdapter {
        isInnerShortcodeCache.RLock()
        defer isInnerShortcodeCache.RUnlock()
 
index 394549c4176cf2d152732e3da71a2d9bb04cd803..4f7c2c5fb595249b9b940edd6fff7b14a4a6fe01 100644 (file)
@@ -676,7 +676,7 @@ func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
                        s.Log.ERROR.Println(err)
                }
 
-               s.Tmpl.PrintErrors()
+               s.TemplateHandler().PrintErrors()
 
                for i := 1; i < len(sites); i++ {
                        site := sites[i]
index cb4dfa64e1c71eb772d7c796ac78f60864dbfa92..562d708280e424f8ff394ec43e211de73e4e640e 100644 (file)
@@ -18,6 +18,8 @@ import (
        "fmt"
        "reflect"
        "strings"
+
+       "github.com/spf13/hugo/tpl"
 )
 
 // Apply takes a map, array, or slice and returns a new slice with the function fname applied over it.
@@ -104,7 +106,12 @@ func applyFnToThis(fn, this reflect.Value, args ...interface{}) (reflect.Value,
 
 func (ns *Namespace) lookupFunc(fname string) (reflect.Value, bool) {
        if !strings.ContainsRune(fname, '.') {
-               fn, found := ns.funcMap[fname]
+               templ, ok := ns.deps.Tmpl.(tpl.TemplateFuncsGetter)
+               if !ok {
+                       panic("Needs a tpl.TemplateFuncsGetter")
+               }
+               fm := templ.GetFuncs()
+               fn, found := fm[fname]
                if !found {
                        return reflect.Value{}, false
                }
index 9718570fd86905b9cdb7bea8849d4a655bde1bfe..ee570993ed3f22de03b724e8e0422a1a0002c9fb 100644 (file)
 package collections
 
 import (
-       "fmt"
-       "html/template"
        "testing"
 
+       "fmt"
+
        "github.com/spf13/hugo/deps"
-       "github.com/spf13/hugo/tpl/strings"
-       "github.com/stretchr/testify/assert"
+       "github.com/spf13/hugo/tpl"
+       "github.com/stretchr/testify/require"
 )
 
-func TestApply(t *testing.T) {
-       t.Parallel()
-
-       hstrings := strings.New(&deps.Deps{})
+type templateFinder int
 
-       ns := New(&deps.Deps{})
-       ns.Funcs(template.FuncMap{
-               "apply":   ns.Apply,
-               "chomp":   hstrings.Chomp,
-               "strings": hstrings,
-               "print":   fmt.Sprint,
-       })
-
-       strings := []interface{}{"a\n", "b\n"}
-       noStringers := []interface{}{tstNoStringer{}, tstNoStringer{}}
+func (templateFinder) Lookup(name string) *tpl.TemplateAdapter {
+       return nil
+}
 
-       result, _ := ns.Apply(strings, "chomp", ".")
-       assert.Equal(t, []interface{}{template.HTML("a"), template.HTML("b")}, result)
+func (templateFinder) GetFuncs() map[string]interface{} {
+       return map[string]interface{}{
+               "print": fmt.Sprint,
+       }
+}
 
-       result, _ = ns.Apply(strings, "chomp", "c\n")
-       assert.Equal(t, []interface{}{template.HTML("c"), template.HTML("c")}, result)
+func TestApply(t *testing.T) {
+       t.Parallel()
 
-       result, _ = ns.Apply(strings, "strings.Chomp", "c\n")
-       assert.Equal(t, []interface{}{template.HTML("c"), template.HTML("c")}, result)
+       ns := New(&deps.Deps{Tmpl: new(templateFinder)})
 
-       result, _ = ns.Apply(strings, "print", "a", "b", "c")
-       assert.Equal(t, []interface{}{"abc", "abc"}, result, "testing variadic")
+       strings := []interface{}{"a\n", "b\n"}
 
-       result, _ = ns.Apply(nil, "chomp", ".")
-       assert.Equal(t, []interface{}{}, result)
+       result, err := ns.Apply(strings, "print", "a", "b", "c")
+       require.NoError(t, err)
+       require.Equal(t, []interface{}{"abc", "abc"}, result, "testing variadic")
 
-       _, err := ns.Apply(strings, "apply", ".")
-       if err == nil {
-               t.Errorf("apply with apply should fail")
-       }
+       _, err = ns.Apply(strings, "apply", ".")
+       require.Error(t, err)
 
        var nilErr *error
        _, err = ns.Apply(nilErr, "chomp", ".")
-       if err == nil {
-               t.Errorf("apply with nil in seq should fail")
-       }
+       require.Error(t, err)
 
        _, err = ns.Apply(strings, "dobedobedo", ".")
-       if err == nil {
-               t.Errorf("apply with unknown func should fail")
-       }
-
-       _, err = ns.Apply(noStringers, "chomp", ".")
-       if err == nil {
-               t.Errorf("apply when func fails should fail")
-       }
-
-       _, err = ns.Apply(tstNoStringer{}, "chomp", ".")
-       if err == nil {
-               t.Errorf("apply with non-sequence should fail")
-       }
+       require.Error(t, err)
 
        _, err = ns.Apply(strings, "foo.Chomp", "c\n")
        if err == nil {
-               t.Errorf("apply with unknown namespace should fail")
+               t.Errorf("apply with unknown func should fail")
        }
 
-       _, err = ns.Apply(strings, "strings.Foo", "c\n")
-       if err == nil {
-               t.Errorf("apply with unknown namespace method should fail")
-       }
 }
index 95d1df64234f96b8a67b60431c89794c0f0a5e2f..86674f423a4e3e0afbe102049595425d95757198 100644 (file)
@@ -21,7 +21,6 @@ import (
        "net/url"
        "reflect"
        "strings"
-       "sync"
        "time"
 
        "github.com/spf13/cast"
@@ -37,24 +36,12 @@ func New(deps *deps.Deps) *Namespace {
 
 // Namespace provides template functions for the "collections" namespace.
 type Namespace struct {
-       sync.Mutex
-       funcMap template.FuncMap
-
        deps *deps.Deps
 }
 
 // Namespace returns a pointer to the current namespace instance.
 func (ns *Namespace) Namespace() *Namespace { return ns }
 
-// Funcs sets the internal funcMap for the collections namespace.
-func (ns *Namespace) Funcs(fm template.FuncMap) *Namespace {
-       ns.Lock()
-       ns.funcMap = fm
-       ns.Unlock()
-
-       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/init.go b/tpl/collections/init.go
new file mode 100644 (file)
index 0000000..ded7b80
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright 2017 The Hugo Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package collections
+
+import (
+       "github.com/spf13/hugo/deps"
+       "github.com/spf13/hugo/tpl/internal"
+)
+
+const name = "collections"
+
+func init() {
+       f := func(d *deps.Deps) *internal.TemplateFuncsNamespace {
+               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!`},
+                       {
+                               `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 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&amp;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]`},
+               }
+
+               return &internal.TemplateFuncsNamespace{
+                       Name:    name,
+                       Context: func() interface{} { return ctx },
+                       Aliases: map[string]interface{}{
+                               "after":     ctx.After,
+                               "apply":     ctx.Apply,
+                               "delimit":   ctx.Delimit,
+                               "dict":      ctx.Dictionary,
+                               "echoParam": ctx.EchoParam,
+                               "first":     ctx.First,
+                               "in":        ctx.In,
+                               "index":     ctx.Index,
+                               "intersect": ctx.Intersect,
+                               "isSet":     ctx.IsSet,
+                               "isset":     ctx.IsSet,
+                               "last":      ctx.Last,
+                               "querify":   ctx.Querify,
+                               "shuffle":   ctx.Shuffle,
+                               "slice":     ctx.Slice,
+                               "sort":      ctx.Sort,
+                               "union":     ctx.Union,
+                               "where":     ctx.Where,
+                               "seq":       ctx.Seq,
+                       },
+                       Examples: examples,
+               }
+
+       }
+
+       internal.AddTemplateFuncsNamespace(f)
+}
index 356d66f1e897b4d0f4fa9a2e287d104703101b6b..9fbf6b7b88682e5adf3b27086e64fc24e1cf5d99 100644 (file)
@@ -96,6 +96,10 @@ func (t *TemplateAdapter) Tree() string {
        return s
 }
 
+type TemplateFuncsGetter interface {
+       GetFuncs() map[string]interface{}
+}
+
 // TemplateTestMocker adds a way to override some template funcs during tests.
 // The interface is named so it's not used in regular application code.
 type TemplateTestMocker interface {
index c86f4cf1e23281d0e3b63bb89d9edc4bd74c294a..77826e0b085e977bba82237c1e0917faddeda0fc 100644 (file)
@@ -39,6 +39,7 @@ const (
 
 var (
        _ tpl.TemplateHandler       = (*templateHandler)(nil)
+       _ tpl.TemplateFuncsGetter   = (*templateHandler)(nil)
        _ tpl.TemplateTestMocker    = (*templateHandler)(nil)
        _ tpl.TemplateFinder        = (*htmlTemplates)(nil)
        _ tpl.TemplateFinder        = (*textTemplates)(nil)
@@ -262,6 +263,10 @@ func (t *templateHandler) SetFuncs(funcMap map[string]interface{}) {
        t.setFuncs(funcMap)
 }
 
+func (t *templateHandler) GetFuncs() map[string]interface{} {
+       return t.html.funcster.funcMap
+}
+
 func (t *htmlTemplates) setFuncs(funcMap map[string]interface{}) {
        t.t.Funcs(funcMap)
 }
index a3ad97a29a7a32989edb1d9230ba733745ff0635..c5134f7405bce147d458fc90d6daba16a78ba2bc 100644 (file)
@@ -21,7 +21,6 @@ import (
 
        bp "github.com/spf13/hugo/bufferpool"
        "github.com/spf13/hugo/deps"
-       "github.com/spf13/hugo/tpl/collections"
        "github.com/spf13/hugo/tpl/crypto"
        "github.com/spf13/hugo/tpl/encoding"
        "github.com/spf13/hugo/tpl/images"
@@ -39,16 +38,15 @@ type templateFuncster struct {
        cachedPartials partialCache
 
        // Namespaces
-       collections *collections.Namespace
-       crypto      *crypto.Namespace
-       encoding    *encoding.Namespace
-       images      *images.Namespace
-       inflect     *inflect.Namespace
-       os          *os.Namespace
-       safe        *safe.Namespace
-       time        *time.Namespace
-       transform   *transform.Namespace
-       urls        *urls.Namespace
+       crypto    *crypto.Namespace
+       encoding  *encoding.Namespace
+       images    *images.Namespace
+       inflect   *inflect.Namespace
+       os        *os.Namespace
+       safe      *safe.Namespace
+       time      *time.Namespace
+       transform *transform.Namespace
+       urls      *urls.Namespace
 
        *deps.Deps
 }
@@ -59,16 +57,15 @@ func newTemplateFuncster(deps *deps.Deps) *templateFuncster {
                cachedPartials: partialCache{p: make(map[string]interface{})},
 
                // Namespaces
-               collections: collections.New(deps),
-               crypto:      crypto.New(),
-               encoding:    encoding.New(),
-               images:      images.New(deps),
-               inflect:     inflect.New(),
-               os:          os.New(deps),
-               safe:        safe.New(),
-               time:        time.New(),
-               transform:   transform.New(deps),
-               urls:        urls.New(deps),
+               crypto:    crypto.New(),
+               encoding:  encoding.New(),
+               images:    images.New(deps),
+               inflect:   inflect.New(),
+               os:        os.New(deps),
+               safe:      safe.New(),
+               time:      time.New(),
+               transform: transform.New(deps),
+               urls:      urls.New(deps),
        }
 }
 
index d56cc661bd3fda0d8ca66d087675ff10d100b217..eb266bc0c89be120a690fce0e145dc459f9145ef 100644 (file)
@@ -24,6 +24,7 @@ import (
        "github.com/spf13/hugo/tpl/internal"
 
        // Init the namespaces
+       _ "github.com/spf13/hugo/tpl/collections"
        _ "github.com/spf13/hugo/tpl/compare"
        _ "github.com/spf13/hugo/tpl/data"
        _ "github.com/spf13/hugo/tpl/lang"
@@ -82,43 +83,30 @@ func (t *templateFuncster) partialCached(name string, context interface{}, varia
 func (t *templateFuncster) initFuncMap() {
        funcMap := template.FuncMap{
                // Namespaces
-               "collections": t.collections.Namespace,
-               "crypto":      t.crypto.Namespace,
-               "encoding":    t.encoding.Namespace,
-               "images":      t.images.Namespace,
-               "inflect":     t.inflect.Namespace,
-               "os":          t.os.Namespace,
-               "safe":        t.safe.Namespace,
+               "crypto":   t.crypto.Namespace,
+               "encoding": t.encoding.Namespace,
+               "images":   t.images.Namespace,
+               "inflect":  t.inflect.Namespace,
+               "os":       t.os.Namespace,
+               "safe":     t.safe.Namespace,
                //"time":        t.time.Namespace,
                "transform": t.transform.Namespace,
                "urls":      t.urls.Namespace,
 
                "absURL":        t.urls.AbsURL,
                "absLangURL":    t.urls.AbsLangURL,
-               "after":         t.collections.After,
-               "apply":         t.collections.Apply,
                "base64Decode":  t.encoding.Base64Decode,
                "base64Encode":  t.encoding.Base64Encode,
                "dateFormat":    t.time.Format,
-               "delimit":       t.collections.Delimit,
-               "dict":          t.collections.Dictionary,
-               "echoParam":     t.collections.EchoParam,
                "emojify":       t.transform.Emojify,
-               "first":         t.collections.First,
                "getenv":        t.os.Getenv,
                "highlight":     t.transform.Highlight,
                "htmlEscape":    t.transform.HTMLEscape,
                "htmlUnescape":  t.transform.HTMLUnescape,
                "humanize":      t.inflect.Humanize,
                "imageConfig":   t.images.Config,
-               "in":            t.collections.In,
-               "index":         t.collections.Index,
                "int":           func(v interface{}) (int, error) { return cast.ToIntE(v) },
-               "intersect":     t.collections.Intersect,
-               "isSet":         t.collections.IsSet,
-               "isset":         t.collections.IsSet,
                "jsonify":       t.encoding.Jsonify,
-               "last":          t.collections.Last,
                "markdownify":   t.transform.Markdownify,
                "md5":           t.crypto.MD5,
                "now":           t.time.Now,
@@ -129,7 +117,6 @@ func (t *templateFuncster) initFuncMap() {
                "print":         fmt.Sprint,
                "printf":        fmt.Sprintf,
                "println":       fmt.Sprintln,
-               "querify":       t.collections.Querify,
                "readDir":       t.os.ReadDir,
                "readFile":      t.os.ReadFile,
                "ref":           t.urls.Ref,
@@ -144,18 +131,12 @@ func (t *templateFuncster) initFuncMap() {
                "safeURL":       t.safe.URL,
                "sanitizeURL":   t.safe.SanitizeURL,
                "sanitizeurl":   t.safe.SanitizeURL,
-               "seq":           t.collections.Seq,
                "sha1":          t.crypto.SHA1,
                "sha256":        t.crypto.SHA256,
-               "shuffle":       t.collections.Shuffle,
                "singularize":   t.inflect.Singularize,
-               "slice":         t.collections.Slice,
-               "sort":          t.collections.Sort,
                "string":        func(v interface{}) (string, error) { return cast.ToStringE(v) },
                "time":          t.time.AsTime,
-               "union":         t.collections.Union,
                "urlize":        t.PathSpec.URLize,
-               "where":         t.collections.Where,
        }
 
        // Merge the namespace funcs
@@ -172,5 +153,4 @@ func (t *templateFuncster) initFuncMap() {
 
        t.funcMap = funcMap
        t.Tmpl.(*templateHandler).setFuncs(funcMap)
-       t.collections.Funcs(funcMap)
 }
index 49a7363d912aa6209408ad7afc19c9ac9abab4bf..b7212cfc21d8173e31fdf0349ecf35d9f6be0293 100644 (file)
@@ -129,8 +129,6 @@ base64Decode 2: {{ 42 | base64Encode | base64Decode }}
 base64Encode: {{ "Hello world" | base64Encode }}
 crypto.MD5: {{ crypto.MD5 "Hello world, gophers!" }}
 dateFormat: {{ dateFormat "Monday, Jan 2, 2006" "2015-01-21" }}
-delimit: {{ delimit (slice "A" "B" "C") ", " " and " }}
-echoParam: {{ echoParam .Params "langCode" }}
 emojify: {{ "I :heart: Hugo" | emojify }}
 htmlEscape 1: {{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>" | safeHTML}}
 htmlEscape 2: {{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>"}}
@@ -143,7 +141,6 @@ humanize 1: {{ humanize "my-first-post" }}
 humanize 2: {{ humanize "myCamelPost" }}
 humanize 3: {{ humanize "52" }}
 humanize 4: {{ humanize 103 }}
-in: {{ if in "this string contains a substring" "substring" }}Substring found!{{ end }}
 jsonify: {{ (slice "A" "B" "C") | jsonify }}
 markdownify: {{ .Title | markdownify}}
 md5: {{ md5 "Hello world, gophers!" }}
@@ -152,8 +149,6 @@ printf: {{ printf "%s!" "works" }}
 println: {{ println "works!" -}}
 plainify: {{ plainify  "Hello <strong>world</strong>, gophers!" }}
 pluralize: {{ "cat" | pluralize }}
-querify 1: {{ (querify "foo" 1 "bar" 2 "baz" "with spaces" "qux" "this&that=those") | safeHTML }}
-querify 2: <a href="https://www.google.com?{{ (querify "q" "test" "page" 3) | safeURL }}">Search</a>
 readDir: {{ range (readDir ".") }}{{ .Name }}{{ end }}
 readFile: {{ readFile "README.txt" }}
 relLangURL: {{ "index.html" | relLangURL }}
@@ -165,14 +160,11 @@ safeHTML: {{ "Bat&Man" | safeHTML | safeHTML }}
 safeHTML: {{ "Bat&Man" | safeHTML }}
 safeJS: {{ "(1*2)" | safeJS | safeJS }}
 safeURL: {{ "http://gohugo.io" | safeURL | safeURL }}
-seq: {{ seq 3 }}
 sha1: {{ sha1 "Hello world, gophers!" }}
 sha256: {{ sha256 "Hello world, gophers!" }}
 singularize: {{ "cats" | singularize }}
-sort: {{ slice "B" "C" "A" | sort }}
 strings.TrimPrefix: {{ strings.TrimPrefix "Goodbye,, world!" "Goodbye," }}
 time: {{ (time "2015-01-21").Year }}
-union: {{ union (slice 1 2 3) (slice 3 4 5) }}
 urlize: {{ "Bat Man" | urlize }}
 `
 
@@ -185,8 +177,6 @@ base64Decode 2: 42
 base64Encode: SGVsbG8gd29ybGQ=
 crypto.MD5: b3029f756f98f79e7f1b7f1d1f0dd53b
 dateFormat: Wednesday, Jan 21, 2015
-delimit: A, B and C
-echoParam: en
 emojify: I ❤️ Hugo
 htmlEscape 1: Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;
 htmlEscape 2: Cathal Garvey &amp;amp; The Sunshine Band &amp;lt;cathal@foo.bar&amp;gt;
@@ -199,7 +189,6 @@ humanize 1: My first post
 humanize 2: My camel post
 humanize 3: 52nd
 humanize 4: 103rd
-in: Substring found!
 jsonify: ["A","B","C"]
 markdownify: <strong>BatMan</strong>
 md5: b3029f756f98f79e7f1b7f1d1f0dd53b
@@ -208,8 +197,6 @@ printf: works!
 println: works!
 plainify: Hello world, gophers!
 pluralize: cats
-querify 1: bar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose
-querify 2: <a href="https://www.google.com?page=3&amp;q=test">Search</a>
 readDir: README.txt
 readFile: Hugo Rocks!
 relLangURL: /hugo/en/index.html
@@ -221,14 +208,11 @@ safeHTML: Bat&Man
 safeHTML: Bat&Man
 safeJS: (1*2)
 safeURL: http://gohugo.io
-seq: [1 2 3]
 sha1: c8b5b0e33d408246e30f53e32b8f7627a7a649d4
 sha256: 6ec43b78da9669f50e4e422575c54bf87536954ccd58280219c393f2ce352b46
 singularize: cat
-sort: [A B C]
 strings.TrimPrefix: , world!
 time: 2015
-union: [1 2 3 4 5]
 urlize: bat-man
 `