yeeTemplate

package
v0.0.0-...-89bd919 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFuncMap

func AddFuncMap(key string, fn interface{}) error

AddFuncMap let user to register a func in the template.

func AddTemplateExt

func AddTemplateExt(ext string)

AddTemplateExt add new extension for template.

func AssetsCSS

func AssetsCSS(src string) template.HTML

AssetsCSS returns stylesheet link tag with src string.

func AssetsJs

func AssetsJs(src string) template.HTML

AssetsJs returns script tag with src string.

func BuildTemplate

func BuildTemplate(dir string, files ...string) error

BuildTemplate will build all template files in a directory. it makes beego can render any template file in view directory.

func Compare

func Compare(a, b interface{}) (equal bool)

Compare is a quick and dirty comparison function. It will convert whatever you give it to strings and see if the two values are equal. Whitespace is trimmed. Used by the template parser as "eq".

func CompareNot

func CompareNot(a, b interface{}) (equal bool)

CompareNot !Compare

func Date

func Date(t time.Time, format string) string

Date takes a PHP like date func to Go's time format.

func DateFormat

func DateFormat(t time.Time, layout string) (datestring string)

DateFormat takes a time and a layout string and returns a string with the formatted date. Used by the template parser as "dateformat"

func DateParse

func DateParse(dateString, format string) (time.Time, error)

DateParse Parse Date use PHP time format.

func ExecuteTemplate

func ExecuteTemplate(wr io.Writer, name string, data interface{}) error

ExecuteTemplate applies the template with name to the specified data object, writing the output to wr. A template will be executed safely in parallel.

func HTML2str

func HTML2str(html string) string

HTML2str returns escaping text convert from html.

func HasTemplateExt

func HasTemplateExt(paths string) bool

HasTemplateExt return this path contains supported template extension of beego or not.

func Htmlquote

func Htmlquote(src string) string

Htmlquote returns quoted html string.

func Htmlunquote

func Htmlunquote(src string) string

Htmlunquote returns unquoted html string.

func MapGet

func MapGet(arg1 interface{}, arg2 ...interface{}) (interface{}, error)

MapGet getting value from map by keys usage:

Data["m"] = map[string]interface{} {
    "a": 1,
    "1": map[string]float64{
        "c": 4,
    },
}

{{ map_get m "a" }} // return 1 {{ map_get m 1 "c" }} // return 4

func NotNil

func NotNil(a interface{}) (isNil bool)

NotNil the same as CompareNot

func ParseForm

func ParseForm(form url.Values, obj interface{}) error

ParseForm will parse form values to struct via tag.

func RenderForm

func RenderForm(obj interface{}) template.HTML

RenderForm will render object to form html. obj must be a struct pointer.

func Str2html

func Str2html(raw string) template.HTML

Str2html Convert string to template.HTML type.

func Substr

func Substr(s string, start, length int) string

Substr returns the substr from start to length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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