ntemplate

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTMLTemplate

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

HTMLTemplate - HTMLTemplate is the representation of a parsed html template, and add the sprig(http://masterminds.github.io/sprig/) functions to template's function map.

func MustNewHTMLTemplate

func MustNewHTMLTemplate(name, text string) *HTMLTemplate

MustNewHTMLTemplate -

func MustParseHTMLTemplate

func MustParseHTMLTemplate(fs fs.FS, patterns ...string) *HTMLTemplate

MustParseHTMLTemplate -

func NewHTMLTemplate

func NewHTMLTemplate(name, text string) (*HTMLTemplate, error)

NewHTMLTemplate -

func ParseHTMLTemplate

func ParseHTMLTemplate(fs fs.FS, patterns ...string) (*HTMLTemplate, error)

ParseHTMLTemplate -

func (*HTMLTemplate) Execute

func (t *HTMLTemplate) Execute(data interface{}) (string, error)

Execute - applies the template to the specified data object

func (*HTMLTemplate) ExecuteTemplate

func (t *HTMLTemplate) ExecuteTemplate(name string, data interface{}) (string, error)

ExecuteTemplate - applies the template associated with t that has the given name to the specified data object

func (*HTMLTemplate) Lookup

func (t *HTMLTemplate) Lookup(name string) *HTMLTemplate

Lookup returns the template with the given name that is associated with t, or nil if there is no such template.

type TextTemplate

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

TextTemplate - TextTemplate is the representation of a parsed text template, and add the sprig(http://masterminds.github.io/sprig/) functions to template's function map.

func MustNewTextTemplate

func MustNewTextTemplate(name, text string) *TextTemplate

MustNewTextTemplate -

func MustParseTextTemplate

func MustParseTextTemplate(fs fs.FS, patterns ...string) *TextTemplate

MustParseTextTemplate -

func NewTextTemplate

func NewTextTemplate(name, text string) (*TextTemplate, error)

NewTextTemplate -

func ParseTextTemplate

func ParseTextTemplate(fs fs.FS, patterns ...string) (*TextTemplate, error)

ParseTextTemplate -

func (*TextTemplate) Execute

func (t *TextTemplate) Execute(data interface{}) (string, error)

Execute - applies the template to the specified data object

func (*TextTemplate) ExecuteTemplate

func (t *TextTemplate) ExecuteTemplate(name string, data interface{}) (string, error)

ExecuteTemplate - applies the template associated with t that has the given name to the specified data object

func (*TextTemplate) Lookup

func (t *TextTemplate) Lookup(name string) *TextTemplate

Lookup - returns the template with the given name that is associated with t. It returns nil if there is no such template or the template has no definition.

Jump to

Keyboard shortcuts

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