templ

package
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltInFuncs = template.FuncMap{
	"upper": func(s string) string {
		return strings.ToUpper(s)
	},
	"lower": func(s string) string {
		return strings.ToLower(s)
	},
	"replace": strings.ReplaceAll,
	"trimPrefix": func(prefix, s string) string {
		return strings.TrimPrefix(s, prefix)
	},
	"trimSuffix": func(suffix, s string) string {
		return strings.TrimSuffix(s, suffix)
	},
}

We add a limited set of useful funcs, mostly string handling, to the Go built-ins.

Functions

func MustSprintt added in v0.6.0

func MustSprintt(t string, ctx any) string

MustSprintt is like Sprintt but panics on error.

func Parse added in v0.11.0

func Parse(s string) (*template.Template, error)

Parse parses the Go template in s.

func Sprintt

func Sprintt(t string, ctx any) (string, error)

Sprintt renders the Go template t with the given data in ctx.

Types

This section is empty.

Jump to

Keyboard shortcuts

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