go1.20.5
GoThrough

template.HTMLEscape

// HTMLEscape writes to w the escaped HTML equivalent of the plain text data b. func HTMLEscape(w io.Writer, b []byte)

template.HTMLEscapeString

// HTMLEscapeString returns the escaped HTML equivalent of the plain text data s. func HTMLEscapeString(s string) string

template.HTMLEscaper

// HTMLEscaper returns the escaped HTML equivalent of the textual // representation of its arguments. func HTMLEscaper(args ...any) string

template.IsTrue

// 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 IsTrue(val any) (truth bool, ok bool)

template.JSEscape

// JSEscape writes to w the escaped JavaScript equivalent of the plain text data b. func JSEscape(w io.Writer, b []byte)

template.JSEscapeString

// JSEscapeString returns the escaped JavaScript equivalent of the plain text data s. func JSEscapeString(s string) string

template.JSEscaper

// JSEscaper returns the escaped JavaScript equivalent of the textual // representation of its arguments. func JSEscaper(args ...any) string

template.Must

// 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 Must(t *Template, err error) *Template

template.New

// New allocates a new, undefined template with the given name. func New(name string) *Template

template.ParseFS

// ParseFS is like ParseFiles or ParseGlob but reads from the file system fsys // instead of the host operating system's file system. // It accepts a list of glob patterns. // (Note that most file names serve as glob patterns matching only themselves.) func ParseFS(fsys fs.FS, patterns ...string) (*Template, error)

template.ParseFiles

// 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 ParseFiles(filenames ...string) (*Template, error)

template.ParseGlob

// 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 ParseGlob(pattern string) (*Template, error)

template.URLQueryEscaper

// URLQueryEscaper returns the escaped value of the textual representation of // its arguments in a form suitable for embedding in a URL query. func URLQueryEscaper(args ...any) string