@@ -18,7 +18,6 @@ import (
1818 "path/filepath"
1919 "reflect"
2020 "regexp"
21- "runtime"
2221 "strings"
2322 texttmpl "text/template"
2423 "time"
@@ -56,12 +55,6 @@ var mailSubjectSplit = regexp.MustCompile(`(?m)^-{3,}[\s]*$`)
5655// NewFuncMap returns functions for injecting to templates
5756func NewFuncMap () []template.FuncMap {
5857 return []template.FuncMap {map [string ]interface {}{
59- "GoVer" : func () string {
60- return util .ToTitleCase (runtime .Version ())
61- },
62- "UseHTTPS" : func () bool {
63- return strings .HasPrefix (setting .AppURL , "https" )
64- },
6558 "AppName" : func () string {
6659 return setting .AppName
6760 },
@@ -81,10 +74,7 @@ func NewFuncMap() []template.FuncMap {
8174 "AppVer" : func () string {
8275 return setting .AppVer
8376 },
84- "AppBuiltWith" : func () string {
85- return setting .AppBuiltWith
86- },
87- "AppDomain" : func () string {
77+ "AppDomain" : func () string { // documented in mail-templates.md
8878 return setting .Domain
8979 },
9080 "AssetVersion" : func () string {
@@ -108,11 +98,7 @@ func NewFuncMap() []template.FuncMap {
10898 "CustomEmojis" : func () map [string ]string {
10999 return setting .UI .CustomEmojisMap
110100 },
111- "IsShowFullName" : func () bool {
112- return setting .UI .DefaultShowFullName
113- },
114101 "Safe" : Safe ,
115- "SafeJS" : SafeJS ,
116102 "JSEscape" : JSEscape ,
117103 "Str2html" : Str2html ,
118104 "TimeSince" : timeutil .TimeSince ,
@@ -140,33 +126,15 @@ func NewFuncMap() []template.FuncMap {
140126 "DateFmtLong" : func (t time.Time ) string {
141127 return t .Format (time .RFC1123Z )
142128 },
143- "DateFmtShort" : func (t time.Time ) string {
144- return t .Format ("Jan 02, 2006" )
145- },
146- "CountFmt" : base .FormatNumberSI ,
147- "SubStr" : func (str string , start , length int ) string {
148- if len (str ) == 0 {
149- return ""
150- }
151- end := start + length
152- if length == - 1 {
153- end = len (str )
154- }
155- if len (str ) < end {
156- return str
157- }
158- return str [start :end ]
159- },
129+ "CountFmt" : base .FormatNumberSI ,
160130 "EllipsisString" : base .EllipsisString ,
161- "DiffTypeToStr" : DiffTypeToStr ,
162131 "DiffLineTypeToStr" : DiffLineTypeToStr ,
163132 "ShortSha" : base .ShortSha ,
164133 "ActionContent2Commits" : ActionContent2Commits ,
165134 "PathEscape" : url .PathEscape ,
166135 "PathEscapeSegments" : util .PathEscapeSegments ,
167136 "URLJoin" : util .URLJoin ,
168137 "RenderCommitMessage" : RenderCommitMessage ,
169- "RenderCommitMessageLink" : RenderCommitMessageLink ,
170138 "RenderCommitMessageLinkSubject" : RenderCommitMessageLinkSubject ,
171139 "RenderCommitBody" : RenderCommitBody ,
172140 "RenderCodeBlock" : RenderCodeBlock ,
@@ -429,19 +397,13 @@ func NewFuncMap() []template.FuncMap {
429397 curBranch ,
430398 )
431399 },
432- "RefShortName" : func (ref string ) string {
433- return git .RefName (ref ).ShortName ()
434- },
435400 }}
436401}
437402
438403// NewTextFuncMap returns functions for injecting to text templates
439404// It's a subset of those used for HTML and other templates
440405func NewTextFuncMap () []texttmpl.FuncMap {
441406 return []texttmpl.FuncMap {map [string ]interface {}{
442- "GoVer" : func () string {
443- return util .ToTitleCase (runtime .Version ())
444- },
445407 "AppName" : func () string {
446408 return setting .AppName
447409 },
@@ -454,33 +416,14 @@ func NewTextFuncMap() []texttmpl.FuncMap {
454416 "AppVer" : func () string {
455417 return setting .AppVer
456418 },
457- "AppBuiltWith" : func () string {
458- return setting .AppBuiltWith
459- },
460- "AppDomain" : func () string {
419+ "AppDomain" : func () string { // documented in mail-templates.md
461420 return setting .Domain
462421 },
463422 "TimeSince" : timeutil .TimeSince ,
464423 "TimeSinceUnix" : timeutil .TimeSinceUnix ,
465424 "DateFmtLong" : func (t time.Time ) string {
466425 return t .Format (time .RFC1123Z )
467426 },
468- "DateFmtShort" : func (t time.Time ) string {
469- return t .Format ("Jan 02, 2006" )
470- },
471- "SubStr" : func (str string , start , length int ) string {
472- if len (str ) == 0 {
473- return ""
474- }
475- end := start + length
476- if length == - 1 {
477- end = len (str )
478- }
479- if len (str ) < end {
480- return str
481- }
482- return str [start :end ]
483- },
484427 "EllipsisString" : base .EllipsisString ,
485428 "URLJoin" : util .URLJoin ,
486429 "Dict" : func (values ... interface {}) (map [string ]interface {}, error ) {
@@ -624,11 +567,6 @@ func Safe(raw string) template.HTML {
624567 return template .HTML (raw )
625568}
626569
627- // SafeJS renders raw as JS
628- func SafeJS (raw string ) template.JS {
629- return template .JS (raw )
630- }
631-
632570// Str2html render Markdown text to HTML
633571func Str2html (raw string ) template.HTML {
634572 return template .HTML (markup .Sanitize (raw ))
@@ -925,14 +863,6 @@ func ActionContent2Commits(act Actioner) *repository.PushCommits {
925863 return push
926864}
927865
928- // DiffTypeToStr returns diff type name
929- func DiffTypeToStr (diffType int ) string {
930- diffTypes := map [int ]string {
931- 1 : "add" , 2 : "modify" , 3 : "del" , 4 : "rename" , 5 : "copy" ,
932- }
933- return diffTypes [diffType ]
934- }
935-
936866// DiffLineTypeToStr returns diff line type name
937867func DiffLineTypeToStr (diffType int ) string {
938868 switch diffType {
0 commit comments