diff options
Diffstat (limited to 'modules/templates/base.go')
-rw-r--r-- | modules/templates/base.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/templates/base.go b/modules/templates/base.go index a9b6b2737c..ff31c12899 100644 --- a/modules/templates/base.go +++ b/modules/templates/base.go @@ -12,6 +12,8 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" + + "github.com/unrolled/render" ) // Vars represents variables to be render in golang templates @@ -80,3 +82,15 @@ func getDirAssetNames(dir string) []string { } return tmpls } + +// HTMLRenderer returns a render. +func HTMLRenderer() *render.Render { + return render.New(render.Options{ + Extensions: []string{".tmpl"}, + Directory: "templates", + Funcs: NewFuncMap(), + Asset: GetAsset, + AssetNames: GetAssetNames, + IsDevelopment: !setting.IsProd(), + }) +} |