-
Notifications
You must be signed in to change notification settings - Fork 1
/
ambient_injector.go
22 lines (19 loc) · 1.1 KB
/
ambient_injector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package ambient
import (
"html/template"
"net/http"
)
// AssetInjector represents code that can inject files into a template.
type AssetInjector interface {
Inject(injector LayoutInjector, t *template.Template, r *http.Request, layoutType LayoutType, vars map[string]interface{}) (*template.Template, error)
DebugTemplates() bool
EscapeTemplates() bool
}
// LayoutInjector represents an injector that the AssetInjector will call to inject assets in the correct place.
type LayoutInjector interface {
Head(t *template.Template, content string, fm template.FuncMap, data map[string]interface{}) (*template.Template, error)
Header(t *template.Template, content string, fm template.FuncMap, data map[string]interface{}) (*template.Template, error)
Main(t *template.Template, content string, fm template.FuncMap, data map[string]interface{}) (*template.Template, error)
Footer(t *template.Template, content string, fm template.FuncMap, data map[string]interface{}) (*template.Template, error)
Body(t *template.Template, content string, fm template.FuncMap, data map[string]interface{}) (*template.Template, error)
}