templatefunctions

package
v2.3.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: OSL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetFunc

type AssetFunc struct {
	Router  *router.Router `inject:""`
	Engine  *pugjs.Engine  `inject:""`
	BaseUrl string         `inject:"config:cdn.base_url,optional"`
}

AssetFunc returns the proper URL for the asset, either local or via CDN

func (*AssetFunc) Func

func (af *AssetFunc) Func(ctx context.Context) interface{}

Func as implementation of asset method

type CapitalizeFunc

type CapitalizeFunc struct{}

func (*CapitalizeFunc) Func

func (s *CapitalizeFunc) Func() interface{}

type DataFunc

type DataFunc struct {
	Router *router.Router `inject:""`
}

DataFunc allows templates to access the router's `get` method

func (*DataFunc) Func

func (g *DataFunc) Func(ctx context.Context) interface{}

Func as implementation of get method

type DebugFunc

type DebugFunc struct{}

DebugFunc renders data as JSON, which allows debugging in templates

func (DebugFunc) Func

func (df DebugFunc) Func() interface{}

Func as implementation of debug method

type GetFunc

type GetFunc struct {
	Router *router.Router `inject:""`
}

GetFunc allows templates to access the router's `get` method

func (*GetFunc) Func

func (g *GetFunc) Func(ctx context.Context) interface{}

Func as implementation of get method

type JSON

type JSON struct{}

JSON is our Javascript's JSON equivalent

func (JSON) Parse

func (j JSON) Parse(x string) pugjs.Object

Stringify rounds a value up to the next biggest integer

func (JSON) Stringify

func (j JSON) Stringify(x interface{}) string

Stringify rounds a value up to the next biggest integer

type JsJSON

type JsJSON struct{}

JsJSON is exported as a template function

func (JsJSON) Func

func (jl JsJSON) Func() interface{}

Func returns the JSON object

type JsMath

type JsMath struct{}

JsMath is exported as a template function

func (JsMath) Func

func (ml JsMath) Func() interface{}

Func as implementation of debug method

type JsObject

type JsObject struct{}

JsObject template function

func (JsObject) Func

func (ol JsObject) Func() interface{}

Func as implementation of debug method

type Math

type Math struct{}

Math is our Javascript's Math equivalent

func (Math) Ceil

func (m Math) Ceil(x interface{}) int

Ceil rounds a value up to the next biggest integer

func (Math) Max

func (m Math) Max(x ...interface{}) (res float64)

Max gets the maximum value

func (Math) Min

func (m Math) Min(x ...interface{}) (res float64)

Min gets the minimum value

func (Math) Round

func (m Math) Round(x interface{}) int

Round rounds a value to the nearest integer

func (Math) Trunc

func (m Math) Trunc(x interface{}) int

Trunc drops the decimals

type Object

type Object struct{}

Object implementation

func (Object) Assign

func (o Object) Assign(target *pugjs.Map, sources ...*pugjs.Map) pugjs.Object

Assign all properties from the sources to the target map

func (Object) Keys

func (o Object) Keys(obj interface{}) *pugjs.Array

Keys returns all keys of a map in lexical order

type StartsWithFunc

type StartsWithFunc struct{}

func (*StartsWithFunc) Func

func (s *StartsWithFunc) Func() interface{}

type StriptagsFunc

type StriptagsFunc struct{}

func (StriptagsFunc) Func

func (df StriptagsFunc) Func() interface{}

Func as implementation of debug method

type TrimFunc

type TrimFunc struct{}

func (*TrimFunc) Func

func (s *TrimFunc) Func() interface{}

type TruncateFunc

type TruncateFunc struct{}

func (*TruncateFunc) Func

func (s *TruncateFunc) Func() interface{}

type TryURLFunc

type TryURLFunc struct {
	Router *router.Router `inject:""`
}

URLFunc allows templates to access the routers `URL` helper method

func (*TryURLFunc) Func

func (u *TryURLFunc) Func(ctx context.Context) interface{}

Func as implementation of url method

type URLFunc

type URLFunc struct {
	Router *router.Router `inject:""`
}

URLFunc allows templates to access the routers `URL` helper method

func (*URLFunc) Func

func (u *URLFunc) Func(ctx context.Context) interface{}

Func as implementation of url method

Jump to

Keyboard shortcuts

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