Documentation ¶
Overview ¶
Package render
Package render ¶
Package render
Index ¶
- func FirstCharacterTitle(str string) string
- func FuncMap() map[string]any
- func Include(template string, templateData any, templateContextData TemplateContextData) string
- func MustInclude(templateName string, templateData any, templateContextData TemplateContextData) (output string, err error)
- func ToSnakeCase(str string) string
- type TemplateContext
- func (templateContext *TemplateContext) Init(templateDirs []string, templateFile string, data any, funcMap map[string]any) (*TemplateContextData, error)
- func (*TemplateContext) Render(templateContextData *TemplateContextData, templateName string) (string, error)
- func (*TemplateContext) RenderFromTemplateContent(templateContextData *TemplateContextData, templateContent string) (codeStr string, err error)
- func (templateContext *TemplateContext) RenderFromTemplateName(templateContextData *TemplateContextData) (code string, err error)
- type TemplateContextData
- type TemplateContextInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstCharacterTitle ¶
func Include ¶
func Include( template string, templateData any, templateContextData TemplateContextData, ) string
include allows to include a template allowing to use filter Eg: {{ include "template.tpl" | indent 4 }}
func MustInclude ¶
func MustInclude( templateName string, templateData any, templateContextData TemplateContextData, ) (output string, err error)
func ToSnakeCase ¶
Types ¶
type TemplateContext ¶
type TemplateContext struct{}
func NewTemplateContext ¶
func NewTemplateContext() (templateContext *TemplateContext)
func (*TemplateContext) Init ¶
func (templateContext *TemplateContext) Init( templateDirs []string, templateFile string, data any, funcMap map[string]any, ) (*TemplateContextData, error)
func (*TemplateContext) Render ¶
func (*TemplateContext) Render( templateContextData *TemplateContextData, templateName string, ) (string, error)
func (*TemplateContext) RenderFromTemplateContent ¶
func (*TemplateContext) RenderFromTemplateContent( templateContextData *TemplateContextData, templateContent string, ) (codeStr string, err error)
func (*TemplateContext) RenderFromTemplateName ¶
func (templateContext *TemplateContext) RenderFromTemplateName( templateContextData *TemplateContextData, ) (code string, err error)
type TemplateContextData ¶
type TemplateContextData struct { TemplateContext TemplateContextInterface TemplateName *string Template templateInterface RootData any Data any }
type TemplateContextInterface ¶
type TemplateContextInterface interface { Render( templateContextData *TemplateContextData, templateName string, ) (string, error) RenderFromTemplateContent( templateContextData *TemplateContextData, templateContent string, ) (codeStr string, err error) }
Click to show internal directories.
Click to hide internal directories.