Documentation ¶
Overview ¶
from beego template link: github.com/astaxie/beego/fs.go
from beego template link: github.com/astaxie/beego/template.go
Index ¶
- func AddFuncMap(key string, fn interface{}) error
- func AddTemplateExt(ext string)
- func AddViewPath(viewPath string) error
- func AssetsCSS(text string) template.HTML
- func AssetsJs(text string) template.HTML
- func BuildTemplate(dir string, files ...string) error
- func DateFormat(t time.Time) string
- func DateTimeFormat(t time.Time, format string) string
- func ExecuteTemplate(wr io.Writer, name, viewPath string, runMode string, data interface{}) error
- func ExecuteViewPathTemplate(wr io.Writer, name string, viewPath string, runMode string, data interface{}) error
- func HTML2str(html string) string
- func HasTemplateExt(paths string) bool
- func InSlice(v string, sl []string) bool
- func IntDate(val int64) (ret string)
- func IntDateTime(val int64) (ret string)
- func IntDateTimeFormat(val int64, format string) (ret string)
- func SetTemplateFSFunc(fnt templateFSFunc)
- func Str2html(str string) template.HTML
- func Substr(s string, start, length int) string
- func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error
- type Delims
- type FileSystem
- type HTMLRender
- type Render
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFuncMap ¶
AddFuncMap let user to register a func in the template.
func AddTemplateExt ¶
func AddTemplateExt(ext string)
AddTemplateExt add new extension for template.
func BuildTemplate ¶
BuildTemplate will build all template files in a directory. it makes beego can render any template file in view directory.
func DateTimeFormat ¶
DateTimeFormat 格式化时间显示 format = "YYYY-MM-DD HH:mm:ss" or "YYYY年MM月DD日"
func ExecuteTemplate ¶
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 ExecuteViewPathTemplate ¶
func ExecuteViewPathTemplate(wr io.Writer, name string, viewPath string, runMode string, data interface{}) error
ExecuteViewPathTemplate applies the template with name and from specific viewPath to the specified data object, writing the output to wr. A template will be executed safely in parallel.
func HasTemplateExt ¶
HasTemplateExt return this path contains supported template extension of beego or not.
func IntDateTime ¶
IntDateTime return datetime string format ="YYYY-MM-DD HH:mm:ss"
func IntDateTimeFormat ¶
DateTimeFormat return datetime string format ="YYYY-MM-DD HH:mm:ss" or format ="YYYY-MM-DD HH:mm"
func SetTemplateFSFunc ¶
func SetTemplateFSFunc(fnt templateFSFunc)
SetTemplateFSFunc set default filesystem function
Types ¶
type FileSystem ¶
type FileSystem struct{}
type HTMLRender ¶
type HTMLRender struct { ViewPath string Name string AutoRender bool FuncMap template.FuncMap Data interface{} Delims Delims RunMode string }
HTMLRender a simple html render
func (HTMLRender) Instance ¶
func (m HTMLRender) Instance(dir, name string, funcMap template.FuncMap, delims Delims, autoRender bool, runMode string, data interface{}) Render
Instance
func (HTMLRender) WriteContentType ¶
func (m HTMLRender) WriteContentType(w http.ResponseWriter)
type Render ¶
type Render interface { Render(w http.ResponseWriter) error WriteContentType(w http.ResponseWriter) }
Render interface is to be implemented by HTML