Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config represents the options for passing.
type TemplateConfig ¶
type TemplateConfig interface {
GetRoot() string
GetExtension() string
GetMaster() string
GetFS() verbisfs.FS
}
TemplateConfig represents the functions for obtaining the executor configuration including "root", "master" and "extension".
type TemplateDataGetter ¶
TemplateDataGetter represents the the Data function for obtaining post relevant data to send back to the template.
type TemplateExecutor ¶
type TemplateExecutor interface {
Exists(template string) bool
Execute(w io.Writer, name string, data interface{}) (string, error)
ExecutePost(w io.Writer, name string, ctx *gin.Context, post *domain.PostDatum) (string, error)
Config() TemplateConfig
Executor() TemplateExecutor
}
TemplateExecutor represents the functions for executing template.
type TemplateFuncGetter ¶
type TemplateFuncGetter interface {
FuncMap(ctx *gin.Context, post *domain.PostDatum, cfg TemplateConfig) template.FuncMap
GenericFuncMap() template.FuncMap
}
TemplateFuncGetter represents the functions for obtaining template.FuncMap's for use in Verbis templates.
type TemplateHandler ¶
type TemplateHandler interface {
TemplateFuncGetter
TemplateDataGetter
Prepare(c TemplateConfig) TemplateExecutor
ExecuteTpl(w io.Writer, text string, data interface{}) error
}
TemplateHandler is the main template renderer for Verbis It's responsible for preparing and executing templates and obtaining information such as function maps and post specific data.