-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfuncmap_test.go
More file actions
40 lines (32 loc) · 847 Bytes
/
funcmap_test.go
File metadata and controls
40 lines (32 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2018 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Blue Oak Model License
// license that can be found in the LICENSE file.
package funcmap
import (
"bytes"
"text/template"
)
// helper function parses and applies the template and returns the
// results in string format.
func execute(text string, data map[string]interface{}) (string, error) {
var buf bytes.Buffer
t, err := template.New("_").Funcs(Funcs).Parse(text)
if err != nil {
return buf.String(), err
}
err = t.Execute(&buf, data)
return buf.String(), err
}
// https://github.com/leekchan/gtf
// https://github.com/Masterminds/sprig
// # HUGO
// # MISC
// default
// seq (collections?) slices
// cond
// # URL
// querify (collections?) slices
// CUSTOM
// * uppercasefirst
// * since
// * base, dir, ext, clean, abs