django

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2016 License: MIT Imports: 8 Imported by: 6

README

Folder information

This folder contains the buit'n django/pongo2 cross-framework template engine support.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Filters for pongo2, map[name of the filter] the filter function . The filters are auto register
	Filters map[string]pongo2.FilterFunction
	// Globals share context fields between templates. https://github.com/flosch/pongo2/issues/35
	Globals map[string]interface{}
	// DebugTemplates enables template debugging.
	// The verbose error messages will appear in browser instead of quiet passes with error code
	DebugTemplates bool
}

Config for django template engine

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the django template engine

type Engine

type Engine struct {
	Config Config
	// contains filtered or unexported fields
}

Engine the pongo2 engine

func New

func New(cfg ...Config) *Engine

New creates and returns a Pongo template engine

func (*Engine) ExecuteRaw

func (p *Engine) ExecuteRaw(src string, wr io.Writer, binding interface{}) (err error)

ExecuteRaw receives, parse and executes raw source template contents it's super-simple function without options and funcs, it's not used widely implements the EngineRawExecutor interface

func (*Engine) ExecuteWriter

func (p *Engine) ExecuteWriter(out io.Writer, name string, binding interface{}, options ...map[string]interface{}) error

ExecuteWriter executes a templates and write its results to the out writer layout here is useless

func (*Engine) Funcs

func (p *Engine) Funcs() map[string]interface{}

Funcs should returns the helper funcs

func (*Engine) LoadAssets

func (p *Engine) LoadAssets(virtualDirectory string, virtualExtension string, assetFn func(name string) ([]byte, error), namesFn func() []string) error

LoadAssets loads the templates by binary

func (*Engine) LoadDirectory

func (p *Engine) LoadDirectory(dir string, extension string) (templateErr error)

LoadDirectory builds the templates

Jump to

Keyboard shortcuts

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