Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl/data
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-04-30 20:11:18 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-05-01 16:13:41 +0300
commit656155736721547fef45466a28295f6a563cdd1f (patch)
tree13aa671f78461950a8370779f0cda1ced8b4d4f8 /tpl/data
parent0ab23eb5a87efd7db96e11fb3665f0d30336217c (diff)
tpl/data: Make it a package that stands on its own
See #3042
Diffstat (limited to 'tpl/data')
-rw-r--r--tpl/data/init.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/tpl/data/init.go b/tpl/data/init.go
new file mode 100644
index 000000000..476e9ab75
--- /dev/null
+++ b/tpl/data/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 data
+
+import (
+ "github.com/spf13/hugo/deps"
+ "github.com/spf13/hugo/tpl/internal"
+)
+
+const name = "data"
+
+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{}{
+ "getCSV": ctx.GetCSV,
+ "getJSON": ctx.GetJSON,
+ },
+ Examples: examples,
+ }
+ }
+
+ internal.AddTemplateFuncsNamespace(f)
+}