tplfunc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2017 License: Apache-2.0 Imports: 7 Imported by: 130

Documentation

Overview

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var TplFuncMap template.FuncMap = template.FuncMap{
	"Now":             Now,
	"Eq":              Eq,
	"Add":             Add,
	"Sub":             Sub,
	"IsNil":           IsNil,
	"IsEmpty":         IsEmpty,
	"NotEmpty":        NotEmpty,
	"Html":            ToHTML,
	"Js":              ToJS,
	"Css":             ToCSS,
	"ToJS":            ToJS,
	"ToCSS":           ToCSS,
	"ToURL":           ToURL,
	"ToHTML":          ToHTML,
	"ToHTMLAttr":      ToHTMLAttr,
	"ToHTMLAttrs":     ToHTMLAttrs,
	"ToStrSlice":      ToStrSlice,
	"Concat":          Concat,
	"ElapsedMemory":   com.ElapsedMemory,
	"TotalRunTime":    com.TotalRunTime,
	"CaptchaForm":     CaptchaForm,
	"FormatByte":      com.FormatByte,
	"FriendlyTime":    FriendlyTime,
	"FormatPastTime":  com.FormatPastTime,
	"DateFormat":      com.DateFormat,
	"DateFormatShort": com.DateFormatShort,
	"Replace":         strings.Replace,
	"Contains":        strings.Contains,
	"HasPrefix":       strings.HasPrefix,
	"HasSuffix":       strings.HasSuffix,
	"Split":           strings.Split,
	"Join":            strings.Join,
	"Ext":             filepath.Ext,
	"InExt":           InExt,
	"Str":             com.Str,
	"Int":             com.Int,
	"Int32":           com.Int32,
	"Int64":           com.Int64,
	"Float32":         com.Float32,
	"Float64":         com.Float64,
	"InSlice":         com.InSlice,
	"InSliceI":        com.InSliceIface,
	"Substr":          com.Substr,
	"StripTags":       com.StripTags,
	"Default":         Default,
	"JsonEncode":      JsonEncode,
	"UrlEncode":       com.UrlEncode,
	"UrlDecode":       com.UrlDecode,
	"Base64Encode":    com.Base64Encode,
	"Base64Decode":    com.Base64Decode,
	"Set":             Set,
	"Append":          Append,
	"Nl2br":           NlToBr,
	"AddSuffix":       AddSuffix,
	"InStrSlice":      InStrSlice,
	"SearchStrSlice":  SearchStrSlice,
}

Functions

func Add

func Add(left interface{}, right interface{}) interface{}

func AddSuffix

func AddSuffix(s string, suffix string, args ...string) string

func Append

func Append(renderArgs map[string]interface{}, key string, value interface{}) string

func CaptchaForm

func CaptchaForm(args ...string) template.HTML

CaptchaForm 验证码表单域

func CaptchaVerify

func CaptchaVerify(captchaSolution string, idGet func(string) string) bool

CaptchaVerify 验证码验证

func Concat

func Concat(s ...string) string

func Default

func Default(defaultV interface{}, v interface{}) interface{}

func Eq

func Eq(left interface{}, right interface{}) bool

func FriendlyTime

func FriendlyTime(t interface{}, args ...string) string

func InExt

func InExt(fileName string, exts ...string) bool

func InStrSlice

func InStrSlice(values []string, value string) bool

func IsEmpty

func IsEmpty(a interface{}) bool

func IsNil

func IsNil(a interface{}) bool

func JsonEncode

func JsonEncode(s interface{}) string

func New

func New() (r template.FuncMap)

func Nl2br

func Nl2br(text string) string

Nl2br 将换行符替换为<br />

func NlToBr

func NlToBr(text string) template.HTML

NlToBr Replaces newlines with <br />

func NotEmpty

func NotEmpty(a interface{}) bool

func Now

func Now() time.Time

func SearchStrSlice

func SearchStrSlice(values []string, value string) int

func Set

func Set(renderArgs map[string]interface{}, key string, value interface{}) string

func Sub

func Sub(left interface{}, right interface{}) interface{}

func ToCSS

func ToCSS(raw string) template.CSS

func ToHTML

func ToHTML(raw string) template.HTML

func ToHTMLAttr

func ToHTMLAttr(raw string) template.HTMLAttr

func ToHTMLAttrs

func ToHTMLAttrs(raw map[string]interface{}) (r map[template.HTMLAttr]interface{})

func ToJS

func ToJS(raw string) template.JS

func ToStrSlice

func ToStrSlice(s ...string) []string

func ToURL

func ToURL(raw string) template.URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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