mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-17 12:53:01 -06:00
provide noescape function for templates
This commit is contained in:
parent
adf4712b39
commit
89c369f21e
3 changed files with 22 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ package router
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
|
@ -46,6 +47,8 @@ type Router interface {
|
|||
AttachMiddleware(handler gin.HandlerFunc)
|
||||
// Attach 404 NoRoute handler
|
||||
AttachNoRouteHandler(handler gin.HandlerFunc)
|
||||
// Set Template function map
|
||||
SetTemplateFuncMap(functions template.FuncMap)
|
||||
// Start the router
|
||||
Start()
|
||||
// Stop the router
|
||||
|
|
@ -98,6 +101,11 @@ func (r *router) Stop(ctx context.Context) error {
|
|||
return r.srv.Shutdown(ctx)
|
||||
}
|
||||
|
||||
// Set Template function map
|
||||
func (r *router) SetTemplateFuncMap(functions template.FuncMap) {
|
||||
r.engine.SetFuncMap(functions)
|
||||
}
|
||||
|
||||
// New returns a new Router with the specified configuration, using the given logrus logger.
|
||||
//
|
||||
// The given DB is only used in the New function for parsing config values, and is not otherwise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue