handlebars

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: 1

README

Folder information

This folder contains the buit'n handlebars/raymond cross-framework template engine support.

Documentation

Overview

Package handlebars the HandlebarsEngine's functionality

Index

Constants

View Source
const (
	// NoLayout to disable layout for a particular template file
	NoLayout = "@.|.@no_layout@.|.@"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Helpers for Handlebars, you can register your own by raymond.RegisterHelper(name string, a interface{}) or RegisterHelpers(map[string]interface{})
	// or just fill this method, do not override it it is not nil by default (because of Iris' helpers (url and urlpath)
	Helpers map[string]interface{}
	Layout  string
}

Config for handlebars template engine

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configs for the handlebars template engine

type Engine

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

Engine the Handlebars engine

func New

func New(cfg ...Config) *Engine

New creates and returns the Handlebars template engine

func (*Engine) ExecuteRaw

func (e *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 (e *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

func (*Engine) Funcs

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

Funcs should returns the helper funcs

func (*Engine) LoadAssets

func (e *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 (e *Engine) LoadDirectory(dir string, extension string) error

LoadDirectory builds the handlebars templates

Jump to

Keyboard shortcuts

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