tmpl

package module
v0.0.0-...-010625d Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

README

tmpl

Package tmpl implements a minimal view interface over html/template.

Use of this package encourages proper separation of concerns. Templates are expected to be "dumb" using only the base text/template actions and leverage methods on the view for more complex output.

Documentation

Overview

Package tmpl implements a minimal view interface over html/template.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Template

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

Template represents a set of HTML templates.

func New

func New(fs fs.FS) *Template

New returns a new template set.

func (*Template) Render

func (t *Template) Render(w io.Writer, view Viewable) error

Render writes the result of applying the templates associated with view to the view itself.

type Viewable

type Viewable interface {
	// Templates returns a slice of template names to parse.
	Templates() []string
}

Viewable represents a view.

Jump to

Keyboard shortcuts

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