tmplutil

package
v0.0.0-...-6d3478e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func From

func From(tag string, data string) (*template.Template, error)

From returns a new template.Template instance which has the provided functions added.

func MustFrom

func MustFrom(tag string, data string) *template.Template

MustFrom returns a new template.Template instance with all functions added. It panics if instance failed to be created with returned error.

Types

type Group

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

Group holds a series of template content with associated name. Group returns new templates based on provided sets.

func New

func New() *Group

New returns a new instance of Group.

func (*Group) Add

func (g *Group) Add(name string, data string) *Group

Add adds giving name and template value into group.

func (*Group) From

func (g *Group) From(names ...string) (*template.Template, error)

From acts like New but calls template.Lookup on the retunred template to return the first template object forthe first name in the slice provided.

func (*Group) FromWith

func (g *Group) FromWith(fn template.FuncMap, names ...string) (*template.Template, error)

FromWith acts like New but calls template.Lookup on the retunred template to return the first template object forthe first name in the slice provided.

func (*Group) New

func (g *Group) New(names ...string) (*template.Template, error)

New returns a template from all templates within group if no names are provided. Either arrange names of support template to main template else use template.Lookup method to retrieve template for respective name.

func (*Group) NewWith

func (g *Group) NewWith(fn template.FuncMap, names ...string) (*template.Template, error)

NewWith returns a template from all templates within group if no names are provided. Either arrange names of support template to main template else use template.Lookup method to retrieve template for respective name.

Jump to

Keyboard shortcuts

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