templates

package
v0.0.0-...-08b4e76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TemplateRenderingError

type TemplateRenderingError struct {
	TemplateName string
	// contains filtered or unexported fields
}

func (TemplateRenderingError) Error

func (e TemplateRenderingError) Error() string

func (TemplateRenderingError) Unwrap

func (e TemplateRenderingError) Unwrap() error

type Templates

type Templates struct {
	// contains filtered or unexported fields
}

func NewTemplates

func NewTemplates(templateDir string) Templates

func (*Templates) BuildCache

func (tc *Templates) BuildCache() error

func (*Templates) RenderPage

func (tc *Templates) RenderPage(w io.Writer, page string, data any) error

RenderPage renders a page by the name. If the internal cache is built, e.g. during startup, it's used. Otherwise, templates are rendered with the given data on demand. Any errors are wrapped inside a TemplateRenderingError for further analysis.

func (*Templates) RenderTemplate

func (tc *Templates) RenderTemplate(w io.Writer, page string, template string, data any) error

RenderTemplate is used for rendering specific templates on a given page. If the internal cache is built, e.g. during startup, it's used. Otherwise, templates are rendered with the given data on demand. Any errors are wrapped inside a TemplateRenderingError for further analysis.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL