Documentation ¶
Overview ¶
Package multitemplate implements dynamic and static template rendering
Index ¶
- type DynamicRender
- func (r DynamicRender) Add(name string, tmpl *template.Template)
- func (r DynamicRender) AddFromFiles(name string, files ...string) *template.Template
- func (r DynamicRender) AddFromFilesFS(name string, f fs.FS, files ...string) *template.Template
- func (r DynamicRender) AddFromFilesFuncs(name string, funcMap template.FuncMap, files ...string) *template.Template
- func (r DynamicRender) AddFromFilesFuncsFS(name string, funcMap template.FuncMap, f fs.FS, files ...string) *template.Template
- func (r DynamicRender) AddFromGlob(name, glob string) *template.Template
- func (r DynamicRender) AddFromString(name, templateString string) *template.Template
- func (r DynamicRender) AddFromStringsFuncs(name string, funcMap template.FuncMap, templateStrings ...string) *template.Template
- func (r DynamicRender) Instance(name string, data interface{}) render.Render
- type Render
- func (r Render) Add(name string, tmpl *template.Template)
- func (r Render) AddFromFiles(name string, files ...string) *template.Template
- func (r Render) AddFromFilesFS(name string, f fs.FS, files ...string) *template.Template
- func (r Render) AddFromFilesFuncs(name string, funcMap template.FuncMap, files ...string) *template.Template
- func (r Render) AddFromFilesFuncsFS(name string, funcMap template.FuncMap, f fs.FS, files ...string) *template.Template
- func (r Render) AddFromGlob(name, glob string) *template.Template
- func (r Render) AddFromString(name, templateString string) *template.Template
- func (r Render) AddFromStringsFuncs(name string, funcMap template.FuncMap, templateStrings ...string) *template.Template
- func (r Render) Instance(name string, data interface{}) render.Render
- type Renderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamicRender ¶
type DynamicRender map[string]*templateBuilder
DynamicRender type
func NewDynamic ¶
func NewDynamic() DynamicRender
NewDynamic is the constructor for Dynamic templates
func (DynamicRender) Add ¶
func (r DynamicRender) Add(name string, tmpl *template.Template)
Add new template
func (DynamicRender) AddFromFiles ¶
func (r DynamicRender) AddFromFiles(name string, files ...string) *template.Template
AddFromFiles supply add template from files
func (DynamicRender) AddFromFilesFS ¶
AddFromFilesFS supply add template from files from a fs.FS fileystem
func (DynamicRender) AddFromFilesFuncs ¶
func (r DynamicRender) AddFromFilesFuncs(name string, funcMap template.FuncMap, files ...string) *template.Template
AddFromFilesFuncs supply add template from file callback func
func (DynamicRender) AddFromFilesFuncsFS ¶
func (r DynamicRender) AddFromFilesFuncsFS(name string, funcMap template.FuncMap, f fs.FS, files ...string) *template.Template
AddFromFilesFuncsFS supply add template from file callback func and file from fs.FS
func (DynamicRender) AddFromGlob ¶
func (r DynamicRender) AddFromGlob(name, glob string) *template.Template
AddFromGlob supply add template from global path
func (DynamicRender) AddFromString ¶
func (r DynamicRender) AddFromString(name, templateString string) *template.Template
AddFromString supply add template from strings
func (DynamicRender) AddFromStringsFuncs ¶
func (r DynamicRender) AddFromStringsFuncs(name string, funcMap template.FuncMap, templateStrings ...string) *template.Template
AddFromStringsFuncs supply add template from strings
type Render ¶
Render type
func (Render) AddFromFiles ¶
AddFromFiles supply add template from files
func (Render) AddFromFilesFS ¶
AddFromFilesFS supply add template from files from a fs.FS fileystem
func (Render) AddFromFilesFuncs ¶
func (r Render) AddFromFilesFuncs(name string, funcMap template.FuncMap, files ...string) *template.Template
AddFromFilesFuncs supply add template from file callback func
func (Render) AddFromFilesFuncsFS ¶
func (r Render) AddFromFilesFuncsFS(name string, funcMap template.FuncMap, f fs.FS, files ...string) *template.Template
AddFromFilesFuncsFS supply add template from file callback func and file from fs.FS
func (Render) AddFromGlob ¶
AddFromGlob supply add template from global path
func (Render) AddFromString ¶
AddFromString supply add template from strings
type Renderer ¶
type Renderer interface { render.HTMLRender Add(name string, tmpl *template.Template) AddFromFiles(name string, files ...string) *template.Template AddFromFilesFS(name string, f fs.FS, files ...string) *template.Template AddFromGlob(name, glob string) *template.Template AddFromString(name, templateString string) *template.Template AddFromStringsFuncs(name string, funcMap template.FuncMap, templateStrings ...string) *template.Template AddFromFilesFuncs(name string, funcMap template.FuncMap, files ...string) *template.Template AddFromFilesFuncsFS(name string, funcMap template.FuncMap, f fs.FS, files ...string) *template.Template }
Renderer type is the Agnostic Renderer for multitemplates. When gin is in debug mode then all multitemplates works with hot reloading allowing you modify file templates and seeing changes instantly. Renderer should be created using multitemplate.NewRenderer() constructor.
func NewRenderer ¶
func NewRenderer() Renderer
NewRenderer allows create an agnostic multitemplate renderer depending on enabled gin mode