pugtemplate: github.com/i-love-flamingo/pugtemplate/templatefunctions Index | Files

package templatefunctions

import "github.com/i-love-flamingo/pugtemplate/templatefunctions"

Index

Package Files

asset_func.go capitalize_func.go data_func.go debug_func.go escape_html.go get_func.go js_json.go js_math.go js_object.go parseFloat_func.go parseInt_func.go startswith_func.go striptags_func.go trim_func.go truncate.go try_url_func.go url_func.go

type AssetFunc Uses

type AssetFunc struct {
    Router  *web.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 Uses

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

Func as implementation of asset method

type CapitalizeFunc Uses

type CapitalizeFunc struct{}

CapitalizeFunc struct

func (*CapitalizeFunc) Func Uses

func (s *CapitalizeFunc) Func(ctx context.Context) interface{}

Func to make titleCase (CapitalizeFunc)

type DataFunc Uses

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

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

func (*DataFunc) Func Uses

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

Func as implementation of get method

type DebugFunc Uses

type DebugFunc struct{}

DebugFunc renders data as JSON, which allows debugging in templates

func (DebugFunc) Func Uses

func (df DebugFunc) Func(ctx context.Context) interface{}

Func as implementation of debug method

type EscapeHTMLFunc Uses

type EscapeHTMLFunc struct{}

EscapeHTMLFunc is exported as a template function

func (*EscapeHTMLFunc) Func Uses

func (f *EscapeHTMLFunc) Func(context.Context) interface{}

Func - templatefunction to escape html strings

type GetFunc Uses

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

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

func (*GetFunc) Func Uses

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

Func as implementation of get method

type JSON Uses

type JSON struct{}

JSON is our Javascript's JSON equivalent

func (JSON) Parse Uses

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

Parse Stringify parses a string and returns an object

func (JSON) Stringify Uses

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

Stringify returns a string from the json

type JsJSON Uses

type JsJSON struct{}

JsJSON is exported as a template function

func (JsJSON) Func Uses

func (jl JsJSON) Func(ctx context.Context) interface{}

Func returns the JSON object

type JsMath Uses

type JsMath struct{}

JsMath is exported as a template function

func (JsMath) Func Uses

func (ml JsMath) Func(ctx context.Context) interface{}

Func as implementation of debug method

type JsObject Uses

type JsObject struct{}

JsObject template function

func (JsObject) Func Uses

func (ol JsObject) Func(ctx context.Context) interface{}

Func as implementation of debug method

type Math Uses

type Math struct{}

Math is our Javascript's Math equivalent

func (Math) Ceil Uses

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

Ceil rounds a value up to the next biggest integer

func (Math) Max Uses

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

Max gets the maximum value

func (Math) Min Uses

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

Min gets the minimum value

func (Math) Round Uses

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

Round rounds a value to the nearest integer

func (Math) Trunc Uses

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

Trunc drops the decimals

type Object Uses

type Object struct{}

Object implementation

func (Object) Assign Uses

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 Uses

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

Keys returns all keys of a map in lexical order

type ParseFloat Uses

type ParseFloat struct{}

ParseFloat struct for template function

func (*ParseFloat) Func Uses

func (p *ParseFloat) Func(ctx context.Context) interface{}

Func tries to parse any type into a float64, it is checking for pugjs types and also for regular types

type ParseInt Uses

type ParseInt struct{}

ParseInt struct for template function

func (*ParseInt) Func Uses

func (p *ParseInt) Func(ctx context.Context) interface{}

Func tries to parse any type into an integer, it is checking for pugjs types and also for regular types

type StartsWithFunc Uses

type StartsWithFunc struct{}

StartsWithFunc struct

func (*StartsWithFunc) Func Uses

func (s *StartsWithFunc) Func(ctx context.Context) interface{}

Func StartsWithFunc

type StriptagsFunc Uses

type StriptagsFunc struct{}

StriptagsFunc provides template function to strip html tags

func (StriptagsFunc) Func Uses

func (df StriptagsFunc) Func(ctx context.Context) interface{}

Func implements the strip tags template function

type TrimFunc Uses

type TrimFunc struct{}

TrimFunc struct

func (*TrimFunc) Func Uses

func (s *TrimFunc) Func(ctx context.Context) interface{}

Func - TrimFunc

type TruncateFunc Uses

type TruncateFunc struct{}

TruncateFunc struct

func (*TruncateFunc) Func Uses

func (s *TruncateFunc) Func(ctx context.Context) interface{}

Func TruncateFunc

type TryURLFunc Uses

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

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

func (*TryURLFunc) Func Uses

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

Func as implementation of url method

type URLFunc Uses

type URLFunc struct {
    Router    *web.Router     `inject:""`
    Logger    flamingo.Logger `inject:""`
    DebugMode bool            `inject:"config:flamingo.debug.mode"`
}

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

func (*URLFunc) Func Uses

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

Func as implementation of url method

Package templatefunctions imports 15 packages (graph). Updated 2020-09-30. Refresh now. Tools for package owners.