Documentation ¶
Index ¶
- Variables
- func CleanTemplateName(p string) string
- func RecoveryPRE(b []byte, pres [][]byte) []byte
- func RemoveMultiCRLF(b []byte) []byte
- func ReplacePRE(b []byte) ([]byte, [][]byte)
- type BaseManager
- func (b *BaseManager) AddAllow(allows ...string)
- func (b *BaseManager) AddCallback(rootDir string, callback func(name, typ, event string))
- func (b *BaseManager) AddIgnore(ignores ...string)
- func (b *BaseManager) AddWatchDir(ppath string) (err error)
- func (b *BaseManager) CancelWatchDir(oldDir string) (err error)
- func (b *BaseManager) ChangeWatchDir(oldDir string, newDir string) (err error)
- func (b *BaseManager) ClearAllows()
- func (b *BaseManager) ClearCache()
- func (b *BaseManager) ClearCallback()
- func (b *BaseManager) ClearIgnores()
- func (b *BaseManager) Close()
- func (b *BaseManager) DelAllow(allow string)
- func (b *BaseManager) DelCallback(rootDir string)
- func (b *BaseManager) DelIgnore(ignore string)
- func (b *BaseManager) GetTemplate(string) ([]byte, error)
- func (b *BaseManager) SetLogger(logger.Logger)
- func (b *BaseManager) SetTemplate(string, []byte) error
- func (b *BaseManager) Start() error
- type Driver
- type Manager
- type NopRenderer
- func (n *NopRenderer) ClearCache()
- func (n *NopRenderer) Close()
- func (n *NopRenderer) Debug() bool
- func (n *NopRenderer) Fetch(_ string, _ interface{}, _ echo.Context) string
- func (n *NopRenderer) Init()
- func (n *NopRenderer) Logger() logger.Logger
- func (n *NopRenderer) Manager() Manager
- func (n *NopRenderer) MonitorEvent(_ func(string))
- func (n *NopRenderer) RawContent(_ string) ([]byte, error)
- func (n *NopRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error
- func (n *NopRenderer) RenderBy(w io.Writer, tmplName string, tmplContent func(string) ([]byte, error), ...) error
- func (n *NopRenderer) SetContentProcessor(fn func([]byte) []byte)
- func (n *NopRenderer) SetDebug(_ bool)
- func (n *NopRenderer) SetFuncMap(_ func() map[string]interface{})
- func (n *NopRenderer) SetLogger(_ logger.Logger)
- func (n *NopRenderer) SetManager(mgr Manager)
- func (n *NopRenderer) SetTmplPathFixer(_ func(echo.Context, string) string)
- func (n *NopRenderer) TmplDir() string
- func (n *NopRenderer) TmplPath(_ echo.Context, _ string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FE = []byte(`$1 $2`) First = []byte(`$1`) )
Functions ¶
func CleanTemplateName ¶ added in v1.3.5
func RecoveryPRE ¶ added in v1.2.0
func RemoveMultiCRLF ¶ added in v1.3.0
func ReplacePRE ¶ added in v1.2.0
Types ¶
type BaseManager ¶ added in v1.3.5
type BaseManager struct { }
func (*BaseManager) AddAllow ¶ added in v1.3.5
func (b *BaseManager) AddAllow(allows ...string)
func (*BaseManager) AddCallback ¶ added in v1.3.5
func (b *BaseManager) AddCallback(rootDir string, callback func(name, typ, event string))
func (*BaseManager) AddIgnore ¶ added in v1.3.5
func (b *BaseManager) AddIgnore(ignores ...string)
func (*BaseManager) AddWatchDir ¶ added in v1.3.5
func (b *BaseManager) AddWatchDir(ppath string) (err error)
func (*BaseManager) CancelWatchDir ¶ added in v1.3.5
func (b *BaseManager) CancelWatchDir(oldDir string) (err error)
func (*BaseManager) ChangeWatchDir ¶ added in v1.3.5
func (b *BaseManager) ChangeWatchDir(oldDir string, newDir string) (err error)
func (*BaseManager) ClearAllows ¶ added in v1.3.5
func (b *BaseManager) ClearAllows()
func (*BaseManager) ClearCache ¶ added in v1.3.5
func (b *BaseManager) ClearCache()
func (*BaseManager) ClearCallback ¶ added in v1.3.5
func (b *BaseManager) ClearCallback()
func (*BaseManager) ClearIgnores ¶ added in v1.3.5
func (b *BaseManager) ClearIgnores()
func (*BaseManager) Close ¶ added in v1.3.5
func (b *BaseManager) Close()
func (*BaseManager) DelAllow ¶ added in v1.3.5
func (b *BaseManager) DelAllow(allow string)
func (*BaseManager) DelCallback ¶ added in v1.3.5
func (b *BaseManager) DelCallback(rootDir string)
func (*BaseManager) DelIgnore ¶ added in v1.3.5
func (b *BaseManager) DelIgnore(ignore string)
func (*BaseManager) GetTemplate ¶ added in v1.3.5
func (b *BaseManager) GetTemplate(string) ([]byte, error)
func (*BaseManager) SetLogger ¶ added in v1.3.5
func (b *BaseManager) SetLogger(logger.Logger)
func (*BaseManager) SetTemplate ¶ added in v1.6.0
func (b *BaseManager) SetTemplate(string, []byte) error
func (*BaseManager) Start ¶ added in v1.3.5
func (b *BaseManager) Start() error
type Driver ¶
type Driver interface { //初始化模板引擎 Init() //获取模板根路径 TmplDir() string SetTmplPathFixer(func(echo.Context, string) string) TmplPath(echo.Context, string) string Debug() bool SetDebug(bool) SetLogger(logger.Logger) Logger() logger.Logger //设置模板内容预处理器 SetContentProcessor(fn func([]byte) []byte) SetManager(Manager) Manager() Manager //设置模板函数 SetFuncMap(func() map[string]interface{}) //渲染模板 Render(io.Writer, string, interface{}, echo.Context) error RenderBy(w io.Writer, name string, tmplContent func(string) ([]byte, error), data interface{}, ctx echo.Context) error //获取模板渲染后的结果 Fetch(string, interface{}, echo.Context) string //读取模板原始内容 RawContent(string) ([]byte, error) //模板目录监控事件 MonitorEvent(func(string)) //清除模板对象缓存 ClearCache() //关闭并停用模板引擎 Close() }
type Manager ¶ added in v1.1.0
type Manager interface { Start() error Close() ClearCallback() AddCallback(rootDir string, callback func(name, typ, event string)) DelCallback(rootDir string) ClearAllows() AddAllow(allows ...string) DelAllow(allow string) ClearIgnores() AddIgnore(ignores ...string) DelIgnore(ignore string) AddWatchDir(ppath string) (err error) CancelWatchDir(oldDir string) (err error) ChangeWatchDir(oldDir string, newDir string) (err error) SetLogger(logger.Logger) ClearCache() GetTemplate(string) ([]byte, error) SetTemplate(string, []byte) error }
type NopRenderer ¶ added in v1.1.0
type NopRenderer struct {
// contains filtered or unexported fields
}
func (*NopRenderer) ClearCache ¶ added in v1.1.0
func (n *NopRenderer) ClearCache()
func (*NopRenderer) Close ¶ added in v1.1.0
func (n *NopRenderer) Close()
func (*NopRenderer) Debug ¶ added in v1.2.0
func (n *NopRenderer) Debug() bool
func (*NopRenderer) Fetch ¶ added in v1.1.0
func (n *NopRenderer) Fetch(_ string, _ interface{}, _ echo.Context) string
func (*NopRenderer) Init ¶ added in v1.1.0
func (n *NopRenderer) Init()
func (*NopRenderer) Logger ¶ added in v1.1.0
func (n *NopRenderer) Logger() logger.Logger
func (*NopRenderer) Manager ¶ added in v1.4.3
func (n *NopRenderer) Manager() Manager
func (*NopRenderer) MonitorEvent ¶ added in v1.1.0
func (n *NopRenderer) MonitorEvent(_ func(string))
func (*NopRenderer) RawContent ¶ added in v1.1.0
func (n *NopRenderer) RawContent(_ string) ([]byte, error)
func (*NopRenderer) RenderBy ¶ added in v1.6.0
func (n *NopRenderer) RenderBy(w io.Writer, tmplName string, tmplContent func(string) ([]byte, error), values interface{}, c echo.Context) error
RenderBy render by content
func (*NopRenderer) SetContentProcessor ¶ added in v1.1.0
func (n *NopRenderer) SetContentProcessor(fn func([]byte) []byte)
func (*NopRenderer) SetDebug ¶ added in v1.2.0
func (n *NopRenderer) SetDebug(_ bool)
func (*NopRenderer) SetFuncMap ¶ added in v1.1.0
func (n *NopRenderer) SetFuncMap(_ func() map[string]interface{})
func (*NopRenderer) SetLogger ¶ added in v1.1.0
func (n *NopRenderer) SetLogger(_ logger.Logger)
func (*NopRenderer) SetManager ¶ added in v1.1.0
func (n *NopRenderer) SetManager(mgr Manager)
func (*NopRenderer) SetTmplPathFixer ¶ added in v1.4.3
func (n *NopRenderer) SetTmplPathFixer(_ func(echo.Context, string) string)
func (*NopRenderer) TmplDir ¶ added in v1.1.0
func (n *NopRenderer) TmplDir() string
Click to show internal directories.
Click to hide internal directories.