tmpls

package
v0.0.0-...-ff031a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTmpl = errors.New("no such template in map")

Functions

This section is empty.

Types

type Map

type Map map[string]*template.Template

TmplMap is a map of templates that implements the render.HTMLRender interface

func FromDir

func FromDir(baseDir, ext string) (Map, error)

func FromFS

func FromFS(f fs.FS, root, ext string) (Map, error)

func (Map) Instance

func (m Map) Instance(name string, data interface{}) render.Render

Instance returns a Tmpl instance for the given template

type Tmpl

type Tmpl struct {
	*template.Template
	// contains filtered or unexported fields
}

Tmpl implements the render.Render interface

func (Tmpl) Render

func (t Tmpl) Render(res http.ResponseWriter) error

Render renders the template to response writer

func (Tmpl) WriteContentType

func (t Tmpl) WriteContentType(res http.ResponseWriter)

WriteContentType sets content type to HTML

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL