Documentation ¶
Index ¶
- type ContextProcessorFunc
- type EmbedReadFileFunc
- type Template
- func (this *Template) Abs(base, name string) string
- func (this *Template) AddDirectory(dir string)
- func (this *Template) AddFuncs(fns map[string]any)
- func (this *Template) Get(path string) (io.Reader, error)
- func (this *Template) RegisterFilter(name string, fn pongo2.FilterFunction)
- func (this *Template) RegisterTag(name string, parserFunc pongo2.TagParser)
- func (this *Template) Render(w io.Writer, name string, data interface{}, ctx echo.Context) error
- func (this *Template) SetDebug(v bool)
- func (this *Template) SetEmbedReadFileFunc(embedReadFileFunc EmbedReadFileFunc)
- func (this *Template) SetUseEmbed(useEmbed bool)
- func (this *Template) UseContextProcessor(processor ContextProcessorFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextProcessorFunc ¶
type ContextProcessorFunc = func(echoCtx echo.Context, pongoCtx pongo2.Context)
ContextProcessorFunc signature.
type EmbedReadFileFunc ¶
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template implements custom pongo2 rendering engine for echo.
func (*Template) Abs ¶
Abs returns absolute path to file requested. Search path is configured in AddDirectory method. And default directory is "./templates".
func (*Template) AddDirectory ¶
AddDirectory adds a directory to the list of directories searched for templates. Default directory is "./templates".
func (*Template) RegisterFilter ¶
RegisterFilter registers a custom filter. It calls pongo2.RegisterFilter method.
func (*Template) RegisterTag ¶
RegisterTag registers a custom tag. It calls pongo2.RegisterTag method.
func (*Template) Render ¶
Render renders the view. Many other times, this is called in your echo handler functions.
func (*Template) SetDebug ¶
SetDebug sets debug mode to the template set. See pongo2.TemplateSet.Debug for more information.
func (*Template) SetEmbedReadFileFunc ¶
func (this *Template) SetEmbedReadFileFunc(embedReadFileFunc EmbedReadFileFunc)
设置读取函数
func (*Template) UseContextProcessor ¶
func (this *Template) UseContextProcessor(processor ContextProcessorFunc)
UseContextProcessor adds context processor to the pipeline.