aboutsummaryrefslogtreecommitdiff
path: root/template.go
blob: fae5c7f422fac6fbe93a801019699328b318eb69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package koushin

import (
	"fmt"
	"html/template"
	"io"

	"github.com/labstack/echo/v4"
)

type tmpl struct {
	t *template.Template
}

var _ = fmt.Printf

func (t *tmpl) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
	return t.t.ExecuteTemplate(w, name, data)
}

func loadTemplates() (*tmpl, error) {
	t, err := template.New("drmdb").ParseGlob("public/*.html")
	return &tmpl{t}, err
}