Documentation ¶
Index ¶
- Constants
- type Templates
- func (ts *Templates) AddTemplate(text string) (err error)
- func (ts *Templates) AddTemplateFromFile(path string) (err error)
- func (ts *Templates) AddTemplateFromTemplate(tmpl *template.Template) (err error)
- func (ts *Templates) AddTemplatesFromDir(path string) (err error)
- func (ts *Templates) Clone() (*template.Template, error)
- func (ts *Templates) MergeInto(tmpl *template.Template) (out *template.Template, err error)
- func (ts *Templates) NamedRender(name string, data map[string]interface{}) (out string, err error)
- func (ts *Templates) NamedRenderTemplate(name string, tmpl *template.Template, data map[string]interface{}) (out string, err error)
- func (ts *Templates) NamedRenderText(name string, text string, data map[string]interface{}) (out string, err error)
- func (ts *Templates) Render(data map[string]interface{}) (out string, err error)
- func (ts *Templates) RenderFile(path string, data map[string]interface{}) (out string, err error)
- func (ts *Templates) RenderTemplate(tmpl *template.Template, data map[string]interface{}) (out string, err error)
- func (ts *Templates) RenderText(text string, data map[string]interface{}) (out string, err error)
- func (ts *Templates) SetFilesystem(fs fauxfile.Filesystem)
Constants ¶
const TEMP_TEMPLATE_NAME = "xxx111xxx"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Templates ¶
type Templates struct {
// contains filtered or unexported fields
}
func NewTemplates ¶
func NewTemplates() *Templates
func (*Templates) AddTemplate ¶
Includes the contents of the supplied text in the root template.
func (*Templates) AddTemplateFromFile ¶
Includes the contents of the supplied file in the root template.
func (*Templates) AddTemplateFromTemplate ¶
Includes the contents of the supplied parsed template in the root template.
func (*Templates) AddTemplatesFromDir ¶
Includes the contents of the supplied directory in the root template.
func (*Templates) NamedRender ¶
Renders the root template without any overrides into the named template.
func (*Templates) NamedRenderTemplate ¶
func (ts *Templates) NamedRenderTemplate(name string, tmpl *template.Template, data map[string]interface{}) (out string, err error)
Renders an existing parsed template.Template instance into the named template.
func (*Templates) NamedRenderText ¶
func (ts *Templates) NamedRenderText(name string, text string, data map[string]interface{}) (out string, err error)
Overrides portions of the root template and renders the appropriate data into the named template.
func (*Templates) RenderFile ¶
Overrides portions of the root template with a file's contents and renders.
func (*Templates) RenderTemplate ¶
func (ts *Templates) RenderTemplate(tmpl *template.Template, data map[string]interface{}) (out string, err error)
Renders an existing parsed template.Template instance.
func (*Templates) RenderText ¶
Overrides portions of the root template and renders the appropriate data.
func (*Templates) SetFilesystem ¶
func (ts *Templates) SetFilesystem(fs fauxfile.Filesystem)
Allows overriding of the filesystem for unit tests.