aboutsummaryrefslogtreecommitdiff
path: root/pkg/template/template.go
diff options
context:
space:
mode:
authorunknwon <u@gogs.io>2019-07-28 15:10:44 -0700
committerunknwon <u@gogs.io>2019-07-28 15:10:44 -0700
commit35e2cee5c591d2477fc9d335d467805de6d58938 (patch)
tree75f4e0f3794b51992e8ba4a4c46dc99f0b407020 /pkg/template/template.go
parentd775fe793605757e6f51057da9913ad5a11f6336 (diff)
pkg/template: use template function Year to get number of year
To avoid update in each year
Diffstat (limited to 'pkg/template/template.go')
-rw-r--r--pkg/template/template.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/template/template.go b/pkg/template/template.go
index eb85ca7b..6d6d09da 100644
--- a/pkg/template/template.go
+++ b/pkg/template/template.go
@@ -33,6 +33,9 @@ func NewFuncMap() []template.FuncMap {
"GoVer": func() string {
return strings.Title(runtime.Version())
},
+ "Year": func() int {
+ return time.Now().Year()
+ },
"UseHTTPS": func() bool {
return strings.HasPrefix(setting.AppURL, "https")
},
@@ -94,13 +97,13 @@ func NewFuncMap() []template.FuncMap {
}
return str[start:end]
},
- "Join": strings.Join,
- "EllipsisString": tool.EllipsisString,
- "DiffTypeToStr": DiffTypeToStr,
- "DiffLineTypeToStr": DiffLineTypeToStr,
- "Sha1": Sha1,
- "ShortSHA1": tool.ShortSHA1,
- "MD5": tool.MD5,
+ "Join": strings.Join,
+ "EllipsisString": tool.EllipsisString,
+ "DiffTypeToStr": DiffTypeToStr,
+ "DiffLineTypeToStr": DiffLineTypeToStr,
+ "Sha1": Sha1,
+ "ShortSHA1": tool.ShortSHA1,
+ "MD5": tool.MD5,
"ActionContent2Commits": ActionContent2Commits,
"EscapePound": EscapePound,
"RenderCommitMessage": RenderCommitMessage,