package template

Import Path
	text/template (on golang.org and go.dev)

Dependency Relation
	imports 15 packages, and imported by 3 packages

Involved Source Files
	d-> doc.go
	    exec.go
	    funcs.go
	    helper.go
	    option.go
	    template.go

Exported Type Names

type ExecError (struct) ExecError is the custom error type returned when Execute has an error evaluating its template. (If a write error occurs, the actual error is returned; it will not be of type ExecError.) Err error Name string (T) Error() string (T) Unwrap() error T : error
type FuncMap (map) FuncMap is the type of the map defining the mapping from names to functions. Each function must have either a single return value, or two return values of which the second has type error. In that case, if the second (error) return value evaluates to non-nil during execution, execution terminates and Execute returns that error. When template execution invokes a function with an argument list, that list must be assignable to the function's parameter types. Functions meant to apply to arguments of arbitrary type can use parameters of type interface{} or of type reflect.Value. Similarly, functions meant to return a result of arbitrary type can return interface{} or reflect.Value. func (*Template).Funcs(funcMap FuncMap) *Template
type Template (struct) Template is the representation of a parsed template. The *parse.Tree field is exported only for use by html/template and should be treated as unexported by all other clients. Tree *parse.Tree Tree.ParseName string Tree.Root *parse.ListNode (*T) AddParseTree(name string, tree *parse.Tree) (*Template, error) (*T) Clone() (*Template, error) (T) Copy() *parse.Tree (*T) DefinedTemplates() string (*T) Delims(left, right string) *Template (T) ErrorContext(n parse.Node) (location, context string) (*T) Execute(wr io.Writer, data interface{}) error (*T) ExecuteTemplate(wr io.Writer, name string, data interface{}) error (*T) Funcs(funcMap FuncMap) *Template (*T) Lookup(name string) *Template (*T) Name() string (*T) New(name string) *Template (*T) Option(opt ...string) *Template (*T) Parse(text string) (*Template, error) (*T) ParseFiles(filenames ...string) (*Template, error) (*T) ParseGlob(pattern string) (*Template, error) (*T) Templates() []*Template func Must(t *Template, err error) *Template func New(name string) *Template func ParseFiles(filenames ...string) (*Template, error) func ParseGlob(pattern string) (*Template, error) func (*Template).AddParseTree(name string, tree *parse.Tree) (*Template, error) func (*Template).Clone() (*Template, error) func (*Template).Delims(left, right string) *Template func (*Template).Funcs(funcMap FuncMap) *Template func (*Template).Lookup(name string) *Template func (*Template).New(name string) *Template func (*Template).Option(opt ...string) *Template func (*Template).Parse(text string) (*Template, error) func (*Template).ParseFiles(filenames ...string) (*Template, error) func (*Template).ParseGlob(pattern string) (*Template, error) func (*Template).Templates() []*Template func Must(t *Template, err error) *Template
Exported Values
func HTMLEscape(w io.Writer, b []byte) HTMLEscape writes to w the escaped HTML equivalent of the plain text data b.
func HTMLEscaper(args ...interface{}) string HTMLEscaper returns the escaped HTML equivalent of the textual representation of its arguments.
func HTMLEscapeString(s string) string HTMLEscapeString returns the escaped HTML equivalent of the plain text data s.
func IsTrue(val interface{}) (truth, ok bool) IsTrue reports whether the value is 'true', in the sense of not the zero of its type, and whether the value has a meaningful truth value. This is the definition of truth used by if and other such actions.
func JSEscape(w io.Writer, b []byte) JSEscape writes to w the escaped JavaScript equivalent of the plain text data b.
func JSEscaper(args ...interface{}) string JSEscaper returns the escaped JavaScript equivalent of the textual representation of its arguments.
func JSEscapeString(s string) string JSEscapeString returns the escaped JavaScript equivalent of the plain text data s.
func Must(t *Template, err error) *Template Must is a helper that wraps a call to a function returning (*Template, error) and panics if the error is non-nil. It is intended for use in variable initializations such as var t = template.Must(template.New("name").Parse("text"))
func New(name string) *Template New allocates a new, undefined template with the given name.
func ParseFiles(filenames ...string) (*Template, error) ParseFiles creates a new Template and parses the template definitions from the named files. The returned template's name will have the base name and parsed contents of the first file. There must be at least one file. If an error occurs, parsing stops and the returned *Template is nil. When parsing multiple files with the same name in different directories, the last one mentioned will be the one that results. For instance, ParseFiles("a/foo", "b/foo") stores "b/foo" as the template named "foo", while "a/foo" is unavailable.
func ParseGlob(pattern string) (*Template, error) ParseGlob creates a new Template and parses the template definitions from the files identified by the pattern. The files are matched according to the semantics of filepath.Match, and the pattern must match at least one file. The returned template will have the (base) name and (parsed) contents of the first file matched by the pattern. ParseGlob is equivalent to calling ParseFiles with the list of files matched by the pattern. When parsing multiple files with the same name in different directories, the last one mentioned will be the one that results.
func URLQueryEscaper(args ...interface{}) string URLQueryEscaper returns the escaped value of the textual representation of its arguments in a form suitable for embedding in a URL query.