mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-27 18:00:02 +02:00
move templateFuncs to one file, add middleware context.
This commit is contained in:
parent
06deed820d
commit
fa5ad1e465
10 changed files with 173 additions and 95 deletions
28
modules/base/template.go
Normal file
28
modules/base/template.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
)
|
||||
|
||||
func Str2html(raw string) template.HTML {
|
||||
return template.HTML(raw)
|
||||
}
|
||||
|
||||
var TemplateFuncs template.FuncMap = map[string]interface{}{
|
||||
"AppName": func() string {
|
||||
return AppName
|
||||
},
|
||||
"AppVer": func() string {
|
||||
return AppVer
|
||||
},
|
||||
"str2html": Str2html,
|
||||
"TimeSince": TimeSince,
|
||||
"Subtract": Subtract,
|
||||
"ActionIcon": ActionIcon,
|
||||
"ActionDesc": ActionDesc,
|
||||
"DateFormat": DateFormat,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue