Documentation ¶
Index ¶
- Variables
- type Ctx
- type EmailMessage
- type TplSys
- func (t *TplSys) AddTemplate(name, baseTmpl, tmplSrc string, filenames ...string) (*template.Template, error)
- func (t *TplSys) BaseDir() string
- func (t *TplSys) ExecuteTemplate(name string, ctx interface{}) ([]byte, error)
- func (t *TplSys) InitializeStore()
- func (t *TplSys) Partial(name string, ctxs ...interface{}) template.HTML
- func (t *TplSys) PutTemplate(name, baseTmpl, tmplSrc string, filenames ...string) (*template.Template, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoName = errors.New("no template name supplied") ErrTmplNotFound = errors.New("template not found in store") ErrTmplExists = errors.New("template with existing name found in store") ErrNoTmpl = errors.New("no template data provided") )
Errors
Functions ¶
This section is empty.
Types ¶
type Ctx ¶
type Ctx struct { Flashes []interface{} FlashesInfo []interface{} FlashesWarn []interface{} FlashesError []interface{} CsrfToken string Data map[string]interface{} }
Ctx is a common context for other modules to embed/use
type EmailMessage ¶
EmailMessage represents the reusable core of an email
type TplSys ¶
type TplSys struct {
// contains filtered or unexported fields
}
TplSys is the template helper system
func (*TplSys) AddTemplate ¶
func (t *TplSys) AddTemplate(name, baseTmpl, tmplSrc string, filenames ...string) (*template.Template, error)
AddTemplate will add a *template.Template to Tpl.store with "name". If baseTmpl is not empty then find baseTmpl in store and clone it. Proceed as usual. If store already has a template with "name" then an error will be returned
func (*TplSys) ExecuteTemplate ¶
ExecuteTemplate will find the template with "name" and execute it with the provided context If template with "name" doesn't exist then an error will be returned
func (*TplSys) InitializeStore ¶
func (t *TplSys) InitializeStore()
InitializeStore resets template store and file watcher If you change Tpl.BaseDir then you MUST run InitializeStore()