代码拉取完成,页面将自动刷新
package mego
import (
"html/template"
)
// ViewEngine the mego view engine struct
type ViewEngine struct {
engine *tplEngine
reader TplReader
tplFuncMap template.FuncMap
compression bool
}
// render render the view 'viewName' with 'data' and get the view result
func (e *ViewEngine) render(viewName string, data interface{}) Result {
if e.reader == nil {
return nil
}
if len(viewName) == 0 {
return nil
}
return &viewResult{
viewName: viewName,
data: data,
engine: e.engine,
compression: e.compression,
}
}
// Extend extend the view helper functions with 'name' and 'tplFuncMap'
func (e *ViewEngine) Extend(name string, viewFunc interface{}) {
notEmpty("name", name)
notNil("tplFuncMap", viewFunc)
e.engine.AddFunc(name, viewFunc)
}
// newViewEngine create a new view engine in ViewDir with file extension '.gohtml'
func newViewEngine(ioutil TplReader) *ViewEngine {
ve, err := newTplEngine(ioutil, ".gohtml")
panicErr(err)
return &ViewEngine{
engine: ve,
reader: ioutil,
tplFuncMap: make(template.FuncMap),
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。