From 67380cf47b6dfd6ff9999acc73dd7da8f620948f Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 21 Dec 2016 04:08:23 -0500 Subject: Minor code fix --- modules/template/template.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'modules/template') diff --git a/modules/template/template.go b/modules/template/template.go index f005d5ce..ac91bb76 100644 --- a/modules/template/template.go +++ b/modules/template/template.go @@ -96,10 +96,8 @@ func NewFuncMap() []template.FuncMap { "ShortSha": base.ShortSha, "MD5": base.EncodeMD5, "ActionContent2Commits": ActionContent2Commits, - "EscapePound": func(str string) string { - return strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(str) - }, - "RenderCommitMessage": RenderCommitMessage, + "EscapePound": EscapePound, + "RenderCommitMessage": RenderCommitMessage, "ThemeColorMetaTag": func() string { return setting.UI.ThemeColorMetaTag }, @@ -268,6 +266,10 @@ func ActionContent2Commits(act Actioner) *models.PushCommits { return push } +func EscapePound(str string) string { + return strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(str) +} + func DiffTypeToStr(diffType int) string { diffTypes := map[int]string{ 1: "add", 2: "modify", 3: "del", 4: "rename", -- cgit v1.2.3