template

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTemplates

func BuildTemplates(path string) error

BuildTemplates makes templates which is specified by dir path

Types

type Context

type Context map[string]interface{}

Context refers various context of templates

type Template

type Template struct {
	Context map[string]interface{}
	// contains filtered or unexported fields
}

Template is structure of template

func GetTemplate

func GetTemplate(name string) (*Template, error)

GetTemplate returns template specified by name

func NewTemplate

func NewTemplate(path string, name string) (*Template, error)

NewTemplate make template specified dir path and name of template

func NewVirtualTemplate

func NewVirtualTemplate(content string) (*Template, error)

NewVirtualTemplate make template from specified string

func (*Template) Render

func (tmpl *Template) Render(context Context, writer io.Writer) error

Render outputs the templates to writer

Jump to

Keyboard shortcuts

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