Documentation ¶
Index ¶
- Variables
- func AssetURI(origin *url.URL, env trails.Environment, filesys fs.FS) func(string) (string, error)
- func CurrentUser(u any) (string, func() any)
- func Env(e trails.Environment) (string, func() string)
- func Nonce() (string, func() string)
- func RootUrl(u *url.URL) (string, func() string)
- type Parser
Constants ¶
This section is empty.
Variables ¶
var ( ErrMatchedAssets = errors.New("multiple assets matched") ErrNoFiles = errors.New("no files provided") )
Functions ¶
func AssetURI ¶ added in v0.9.4
AssetURI encloses the environment and filesystem so when called executing a template, emits valid URI for client side static and bundled assets.
The asset origin defaults to "/" when it is not configured and is always set with a trailing slash.
func CurrentUser ¶
CurrentUser encloses some value representing a user. It returns "currentUser" as the name of the function for convenient passing to a template.FuncMap and returns a function returning the enclosed value when called.
func Env ¶
func Env(e trails.Environment) (string, func() string)
Env encloses some string representing an environment. It returns "env" as the name of the function for convenient passing to a template.FuncMap and returns a function returning the enclosed value when called.
func Nonce ¶
Nonce returns "nonce" as the name of the function for convenient passing to a template.FuncMap and returns a function generating a uuid.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parse implements Parser with a focus on utilizing embedded HTML templates through fs.FS.
func NewParser ¶
NewParser constructs a Parse with the fses and opts. The order of fs.FS in fses matters. The first reference to a filepath, starting at the beginning of fses, is cached.
Directories ¶
Path | Synopsis |
---|---|
Package templatetest exposes a mock fs.FS that implements basic file operations.
|
Package templatetest exposes a mock fs.FS that implements basic file operations. |