view

package
v8.5.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const NoLayout = "iris.nolayout"

NoLayout disables the configuration's layout for a specific execution.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmberEngine

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

AmberEngine contains the amber view engine structure.

func Amber

func Amber(directory, extension string) *AmberEngine

Amber creates and returns a new amber view engine.

func (*AmberEngine) AddFunc

func (s *AmberEngine) AddFunc(funcName string, funcBody interface{})

AddFunc adds the function to the template's function map. It is legal to overwrite elements of the default actions: - url func(routeName string, args ...string) string - urlpath func(routeName string, args ...string) string - render func(fullPartialName string) (template.HTML, error).

func (*AmberEngine) Binary

func (s *AmberEngine) Binary(assetFn func(name string) ([]byte, error), namesFn func() []string) *AmberEngine

Binary optionally, use it when template files are distributed inside the app executable (.go generated files).

The assetFn and namesFn can come from the go-bindata library.

func (*AmberEngine) ExecuteWriter

func (s *AmberEngine) ExecuteWriter(w io.Writer, filename string, layout string, bindingData interface{}) error

ExecuteWriter executes a template and writes its result to the w writer. layout here is useless.

func (*AmberEngine) Ext

func (s *AmberEngine) Ext() string

Ext returns the file extension which this view engine is responsible to render.

func (*AmberEngine) Load

func (s *AmberEngine) Load() error

Load parses the templates to the engine. It's alos responsible to add the necessary global functions.

Returns an error if something bad happens, user is responsible to catch it.

func (*AmberEngine) Reload

func (s *AmberEngine) Reload(developmentMode bool) *AmberEngine

Reload if setted to true the templates are reloading on each render, use it when you're in development and you're boring of restarting the whole app when you edit a template file.

type DjangoEngine

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

DjangoEngine contains the amber view engine structure.

func Django

func Django(directory, extension string) *DjangoEngine

Django creates and returns a new amber view engine.

func (*DjangoEngine) AddFilter

func (s *DjangoEngine) AddFilter(filterName string, filterBody FilterFunction) *DjangoEngine

AddFilter registers a new filter. If there's already a filter with the same name, RegisterFilter will panic. You usually want to call this function in the filter's init() function: http://golang.org/doc/effective_go.html#init

Same as `RegisterFilter`.

func (*DjangoEngine) AddFunc

func (s *DjangoEngine) AddFunc(funcName string, funcBody interface{})

AddFunc adds the function to the template's Globals. It is legal to overwrite elements of the default actions: - url func(routeName string, args ...string) string - urlpath func(routeName string, args ...string) string - render func(fullPartialName string) (template.HTML, error).

func (*DjangoEngine) Binary

func (s *