Documentation ¶
Overview ¶
Package render provides functionality for rendering HTML when building web applications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextualFuncMap ¶
A ContextualFuncMap is a function that returns an HTML template.FuncMap.
It is used to provide a renderer with template function that have request-scoped data.
type Options ¶
type Options struct { // The directory to serve templates from. Default is "templates". Dir string // The template to use as a layout. Layouts can call {{ yield }}. Defaults // to an empty string (meaning a layout is not used). Layout string // Request-scoped template funcs. Default is nil. Funcs []ContextualFuncMap // Whether or not to recompile templates. Default is false. Do not // recompile templates in production, as this adds a significant // performance penalty. Reload bool }
type Render ¶
type Render struct {
// contains filtered or unexported fields
}
func (*Render) HTML ¶
func (r *Render) HTML(w io.Writer, req *http.Request, name string, data map[string]interface{}, opts ...RenderOptions)
HTML renders the HTML template with the given name. The HTTP request is optional, and can be set to nil. It is only used to add request-specific context to HTML template functions.
Click to show internal directories.
Click to hide internal directories.