templater

package
v0.0.0-...-73e35a2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Templater

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

Templater struct to hold the loaded templates.

func NewTemplater

func NewTemplater(path string) *Templater

NewTemplater returns a Templater with parsed templates in the directory TMPLPATH.

func (*Templater) Render

func (t *Templater) Render(w http.ResponseWriter, name string, data interface{})

Render will render the template of the given name, with the given data, to the given response writer. Will render an error message to the http.ResponseWriter if template is not found. Setting LOADTMPLONREQUEST to true in the environment variables will cause templates to be reloaded on all template renders.

func (*Templater) RenderBuffer

func (t *Templater) RenderBuffer(buf *bytes.Buffer, name string, data interface{}) error

RenderBuffer renders the template of the given name, with the given data, to the given byte buffer

func (*Templater) RenderString

func (t *Templater) RenderString(name string, data interface{}) (string, error)

RenderString renders template with name and data, and returns the rendered string.

Jump to

Keyboard shortcuts

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