template

package
v0.0.0-...-a79fcb7 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package template wraps the golang "text/template" package to provide an enhanced template generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Functions

type Functions = template.FuncMap

Functions is an alias to the template function binding table

type Template

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

Template holds an executable go template. See https://golang.org/pkg/text/template/

func FromFile

func FromFile(path string) (*Template, error)

FromFile loads the template file at path and builds and returns a Template using the file content

func FromString

func FromString(name, content string) *Template

FromString returns a Template with the given name from content

func (*Template) Run

func (t *Template) Run(w io.Writer, data any, funcs Functions) error

Run executes the template tmpl, writing the output to w. funcs are the functions provided to the template. See https://golang.org/pkg/text/template/ for documentation on the template syntax.

Jump to

Keyboard shortcuts

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