Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllHelpers = hctx.Merge( content.New(), debug.New(), encoders.New(), env.New(), escapes.New(), iterators.New(), meta.New(), text.New(), )
AllHelpers contains all of the default helpers for These will be available to all templates.
var InCtx = Middleware
InCtx puts the render engine in the context so the handlers can use it, it also sets a few other values that are useful for the handlers.
Functions ¶
func Middleware ¶
Middleware puts the render engine in the context so the handlers can use it, it also sets a few other values that are useful for the handlers.
func TemplateFS ¶ added in v1.2.13
NewFallbackFS returns a new FS that wraps the given directory and embedded FS. the embed.FS is expected to embed the same files as the directory FS.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func EngineFromCtx ¶ added in v1.2.12
FromCtx returns the render engine from the context, it assumes the render render engine has been set by the render middleware.
func NewEngine ¶
NewEngine builds the render engine based on the file system and the options passed to it.
func (*Engine) RenderHTML ¶ added in v1.2.12
type Option ¶
type Option func(*Engine)
func WithDefaultLayout ¶
WithDefaultLayout sets the default layout for the engine if no layout is specified in the template this layout will be used. By default this is set to "app/layouts/application.html"
func WithHelpers ¶
WithHelpers sets the helpers for the engine these helpers will be available in all templates rendered by this engine.
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
func FromCtx ¶
FromCtx returns the render engine from the context when its called it also adds any value in the valuer into the page, this is useful for the middlewares such as session to add values to the page.