aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorJonas <cez81@users.noreply.github.com>2017-03-02 01:25:44 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-03-02 08:25:44 +0800
commitf3bf40908265d30d4de592dc55916a8a8cc03abb (patch)
tree0054dcf2ee173144aa47676fb6bcc2d9f37c3be1 /modules
parent0380ce269fd1877c018eeee0007f2e6a0f84d1ab (diff)
downloadgitea-f3bf40908265d30d4de592dc55916a8a8cc03abb.tar.gz
gitea-f3bf40908265d30d4de592dc55916a8a8cc03abb.zip
Log config pretty printer (#1097)
Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>
Diffstat (limited to 'modules')
-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()
+ },
}}
}