summaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/helper.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 2a45f76a74..dd8a0fdd35 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -5,6 +5,7 @@
package templates
import (
+ "bytes"
"container/list"
"encoding/json"
"fmt"
@@ -133,6 +134,14 @@ func NewFuncMap() []template.FuncMap {
}
return path
},
+ "JsonPrettyPrint": func(in string) string {
+ var out bytes.Buffer
+ err := json.Indent(&out, []byte(in), "", " ")
+ if err != nil {
+ return ""
+ }
+ return out.String()
+ },
}}
}