Documentation
¶
Overview ¶
Package view renders html/template files to a buffer before committing an HTTP response. Templates are standard-library templates with no hidden DSL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompiledTemplate ¶
type CompiledTemplate struct {
Name string
Source string
Mappings []SourceMapping
}
CompiledTemplate is canonical html/template source produced from a GoForge template. Component files are expanded into these values at compile time.
func CompileForge ¶
func CompileForge(files fs.FS, patterns ...string) ([]CompiledTemplate, error)
CompileForge resolves GoForge structure into ordinary html/template source. With no patterns it recursively compiles every *.forge.html file.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func ParseCompiled ¶
func ParseCompiled(compiled []CompiledTemplate, functions template.FuncMap) (*Engine, error)
ParseCompiled parses compiler output using html/template contextual escaping.
func ParseForge ¶
ParseForge is a development convenience. Production applications should parse embedded compiler output with ParseCompiled.
type Form ¶
type Form struct {
CSRFToken string
OldValues map[string]string
ValidationErrors map[string][]string
}
Form is explicit render state for Forge form directives. OldValues records submitted fields, including submitted empty strings. ValidationErrors holds already-safe application messages which html/template still escapes.