diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-04-30 22:36:26 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-01 15:13:41 +0200 |
commit | a432c90aee51b2f3ddd92b9c4f4cbe762f67adfc (patch) | |
tree | 03df605cc7919853d3829118bdcf1dd94f057d89 /tpl/images/init.go | |
parent | 9aee8ace4e04b6b164b3c13d622021168b072baf (diff) |
tpl/images: Make it a package that stands on its own
See #3042
Diffstat (limited to 'tpl/images/init.go')
-rw-r--r-- | tpl/images/init.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tpl/images/init.go b/tpl/images/init.go new file mode 100644 index 000000000..0c2cb57c4 --- /dev/null +++ b/tpl/images/init.go @@ -0,0 +1,43 @@ +// 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 images + +import ( + "github.com/spf13/hugo/deps" + "github.com/spf13/hugo/tpl/internal" +) + +const name = "images" + +func init() { + f := func(d *deps.Deps) *internal.TemplateFuncsNamespace { + ctx := New(d) + + examples := [][2]string{ + {}, + } + + return &internal.TemplateFuncsNamespace{ + Name: name, + Context: func() interface{} { return ctx }, + Aliases: map[string]interface{}{ + "imageConfig": ctx.Config, + }, + Examples: examples, + } + + } + + internal.AddTemplateFuncsNamespace(f) +} |