Documentation ¶
Index ¶
- Variables
- type Engine
- func (tm *Engine) Render(ctx context.Context, out io.Writer, name string, binding interface{}, ...) error
- func (tm *Engine) RenderHTML(ctx context.Context, name string, binding interface{}, layouts ...string) (template.HTML, error)
- func (tm *Engine) RenderString(ctx context.Context, name string, binding interface{}, layouts ...string) (string, error)
- type Renderer
- type RendererHTML
- type RendererString
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTemplateNotFound = errors.New("template not found") ErrTemplateExecutionFailed = errors.New("template execution failed") ErrTemplateParsingFailed = errors.New("template parsing failed") ErrNoTemplateDirectory = errors.New("no template directory provided") ErrTemplateEngineNotInitialized = errors.New("template engine not initialized") ErrNoTemplatesParsed = errors.New("no templates parsed") )
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine holds parsed templates and manages their rendering.
func New ¶
New initializes a TemplateManager by parsing templates from a glob pattern and adding custom function maps.
func (*Engine) Render ¶
func (tm *Engine) Render(ctx context.Context, out io.Writer, name string, binding interface{}, layouts ...string) error
Render renders a page using the specified layout chain.
func (*Engine) RenderHTML ¶
func (tm *Engine) RenderHTML(ctx context.Context, name string, binding interface{}, layouts ...string) (template.HTML, error)
RenderHTML renders a page using the specified layout chain and returns the result as a template.HTML. This function is useful when embedding the result in a template.
type RendererHTML ¶
Click to show internal directories.
Click to hide internal directories.