summaryrefslogtreecommitdiff
path: root/internal/template.go
blob: 3d2fe4b4b3f720207c17374f290e6a3035b7e08f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package internal

import (
	"html/template"
	"io"

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

type PageData struct {
	Content template.HTML
	Page string
	Pages []string
	Sections []string
}

type SectionData struct {
	Content template.HTML
	Page string
	Sections []string
}

type TemplateRenderer struct {
	Template *template.Template
}

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