tpl

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(c Config)

func FRender

func FRender(b io.Writer, context any, baseKey string, path ...string) error

func Funcs

func Funcs(funcs template.FuncMap)

func Overrides added in v1.6.9

func Overrides(funcs ...func(any) (any, error))

func Processors

func Processors(funcs ...func(any))

func Render

func Render(context any, baseKey string, path ...string) (template.HTML, error)

func RequestProcessors added in v1.6.8

func RequestProcessors(funcs ...func(ctx.ContextWithRequest))

Types

type Config

type Config struct {
	AppName string
	FS      fs.FS
	Bases   []string
	Matches func(path string) bool
	Funcs   template.FuncMap
}

type Renderer

type Renderer interface {
	Add(cfg Config)
	Processors(funcs ...func(any))
	Override(funcs ...func(any) (any, error))
	RequestProcessors(funcs ...func(ctx.ContextWithRequest))
	Render(buffer io.Writer, data any, appKey string, path ...string) error
	Funcs(funcs template.FuncMap)
}
var Global Renderer

type TemplateRenderer

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

func NewRenderer

func NewRenderer() *TemplateRenderer

func (*TemplateRenderer) Add

func (r *TemplateRenderer) Add(cfg Config)

func (*TemplateRenderer) FS

func (r *TemplateRenderer) FS() fs.FS

func (*TemplateRenderer) Funcs

func (r *TemplateRenderer) Funcs(funcs template.FuncMap)

func (*TemplateRenderer) Override added in v1.6.9

func (r *TemplateRenderer) Override(funcs ...func(any) (any, error))

func (*TemplateRenderer) Processors

func (r *TemplateRenderer) Processors(funcs ...func(any))

func (*TemplateRenderer) Render

func (r *TemplateRenderer) Render(b io.Writer, context any, baseKey string, path ...string) error

func (*TemplateRenderer) RequestProcessors added in v1.6.8

func (r *TemplateRenderer) RequestProcessors(funcs ...func(ctx.ContextWithRequest))

Jump to

Keyboard shortcuts

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