templating

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmberEngine

type AmberEngine struct {
	Policy *bluemonday.Policy
	// contains filtered or unexported fields
}

func NewAmber

func NewAmber(templatesFolder, ext string) (AmberEngine, error)

func (AmberEngine) Render

func (e AmberEngine) Render(file string, data interface{}, sanitize bool) ([]byte, error)

func (AmberEngine) SanitizationPolicy

func (e AmberEngine) SanitizationPolicy() *bluemonday.Policy

func (AmberEngine) TemplatesFolder

func (e AmberEngine) TemplatesFolder() string

type DefaultEngine

type DefaultEngine struct {
	Policy *bluemonday.Policy
	// contains filtered or unexported fields
}

func NewDefault

func NewDefault(templatesFolder string) DefaultEngine

func (DefaultEngine) Render

func (e DefaultEngine) Render(file string, data interface{}, sanitize bool) ([]byte, error)

func (DefaultEngine) SanitizationPolicy

func (e DefaultEngine) SanitizationPolicy() *bluemonday.Policy

func (DefaultEngine) TemplatesFolder

func (e DefaultEngine) TemplatesFolder() string

type Engine

type Engine interface {
	TemplatesFolder() string
	Render(template string, data interface{}, sanitize bool) ([]byte, error)
	SanitizationPolicy() *bluemonday.Policy
}

func GetEngine

func GetEngine(engineType EngineType, templatesFolder string) Engine

type EngineType

type EngineType uint8
const (
	E_DEFAULT EngineType = 0 // html/template
	E_PONGO2  EngineType = 1 // https://github.com/flosch/pongo2
	E_AMBER   EngineType = 2 // https://github.com/eknkc/amber

)

type Pongo2Engine

type Pongo2Engine struct {
	Policy *bluemonday.Policy
	// contains filtered or unexported fields
}

func NewPongo2

func NewPongo2(templatesFolder string) Pongo2Engine

func (Pongo2Engine) Render

func (e Pongo2Engine) Render(file string, data interface{}, sanitize bool) ([]byte, error)

func (Pongo2Engine) SanitizationPolicy

func (e Pongo2Engine) SanitizationPolicy() *bluemonday.Policy

func (Pongo2Engine) TemplatesFolder

func (e Pongo2Engine) TemplatesFolder() string

Jump to

Keyboard shortcuts

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