templatex

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 7 Imported by: 3

README

templateX

templateX is a go template engine with some extra features.

go get github.com/rytsh/liz/utils/templatex

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	// Name of the function
	Name string
	// Description of the function
	Description string
	// Usage of the function
	Usage string
}

func FuncInfos

func FuncInfos(fns map[string]interface{}) []Info

type Option

type Option func(options *options)

func WithContent

func WithContent(content string) Option

func WithData

func WithData(values any) Option

func WithIO

func WithIO(w io.Writer) Option

func WithParsed

func WithParsed(parsed bool) Option

func WithTemplate

func WithTemplate(template string) Option

type Template

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

func New

func New(opts ...store.Option) *Template

func (*Template) AddFunc

func (t *Template) AddFunc(funcMap textTemplate.FuncMap)

func (*Template) Execute

func (t *Template) Execute(opts ...Option) error

func (*Template) ExecuteBuffer

func (t *Template) ExecuteBuffer(opts ...Option) ([]byte, error)

func (*Template) ListFunctions

func (t *Template) ListFunctions()

func (*Template) Parse

func (t *Template) Parse(content string) error

Parse content and set new template to parsed.

func (*Template) ParseGlob

func (t *Template) ParseGlob(pattern string) error

func (*Template) Reset

func (t *Template) Reset()

func (*Template) SetDelims

func (t *Template) SetDelims(left, right string) *Template

SetDelims sets the template delimiters to the specified strings and returns the template to allow chaining.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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