19 lines
312 B
Go
19 lines
312 B
Go
package handler
|
|
|
|
import (
|
|
"html/template"
|
|
"io"
|
|
)
|
|
|
|
type Templates struct {
|
|
tmpl *template.Template
|
|
}
|
|
|
|
func NewTemplates(tmpl *template.Template) *Templates {
|
|
return &Templates{tmpl: tmpl}
|
|
}
|
|
|
|
func (t *Templates) Render(w io.Writer, name string, data any) {
|
|
_ = t.tmpl.ExecuteTemplate(w, name+".html", data)
|
|
}
|