template

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParseTemplate = errors.New("template: parse template files")

Functions

func ExecuteHTTP

func ExecuteHTTP(w http.ResponseWriter, t Template, data any)

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

An FS provides access to a file system that produces a safe HTML document templates.

func NewFS

func NewFS(fsys fs.FS) *FS

NewFS allocates a new file system for templates

func (*FS) Funcs added in v0.1.2

func (fsys *FS) Funcs(funcs ...template.FuncMap) *FS

Funcs adds the elements of the argument map to the template's function map.

func (*FS) MustParse

func (fsys *FS) MustParse(filenames ...string) Template

MustParse will panic if unable to parse files

func (*FS) Parse

func (fsys *FS) Parse(filenames ...string) (Template, error)

Parse parses the named files and associates the resulting templates with t

type Template

type Template interface {
	// Execute applies a parsed template to the specified data object, writing the output to wr
	Execute(wr io.Writer, data any) error
}

Jump to

Keyboard shortcuts

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