Commit 04c67311 authored by Dustin L. Howett's avatar Dustin L. Howett

Update documentation for the various loaders

parent af92fa4d
......@@ -9,20 +9,28 @@ type TemplateLoader interface {
LoadTemplate(baseTemplate *template.Template) (*template.Template, error)
}
// Glob is a TemplateLoader that loads templates from a set of files named by a glob
// wildcard.
type Glob string
// LoadTemplate exists to satisfy the TemplateLoader interface.
func (g Glob) LoadTemplate(baseTemplate *template.Template) (*template.Template, error) {
return baseTemplate.ParseGlob(string(g))
}
// Files is a TemplateLoader that loads templates from a list of files.
// Wildcards are not supported.
type Files []string
// LoadTemplate exists to satisfy the TemplateLoader interface.
func (f Files) LoadTemplate(baseTemplate *template.Template) (*template.Template, error) {
return baseTemplate.ParseFiles(f...)
}
// Strings is a TemplateLoader that loads templates from a set of strings.
type Strings []string
// LoadTemplate exists to satisfy the TemplateLoader interface.
func (s Strings) LoadTemplate(baseTemplate *template.Template) (*template.Template, error) {
var err error
for _, v := range s {
......
......@@ -63,9 +63,9 @@ func (m *Model) Bind(id interface{}, dp DataProvider) (*View, error) {
return view, nil
}
// Reload reloads the model's view templates from disk, reconstructing
// all bound views and template functions. No views are re-evaluated or
// re-rendered.
// Reload reloads the model's view templates from the model's loader,
// reconstructing all bound views and template functions. No views are
// re-evaluated or re-rendered.
func (m *Model) Reload() error {
m.mu.Lock()
defer m.mu.Unlock()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment