Home | History | Annotate | Download | only in template

Lines Matching defs:Template

5 package template
10 "text/template/parse"
15 tmpl map[string]*Template // Map from name to defined templates.
25 // Template is the representation of a parsed template. The *parse.Tree
26 // field is exported only for use by html/template and should be treated
28 type Template struct {
36 // New allocates a new, undefined template with the given name.
37 func New(name string) *Template {
38 t := &Template{
45 // Name returns the name of the template.
46 func (t *Template) Name() string {
50 // New allocates a new, undefined template associated with the given one and with the same
51 // delimiters. The association, which is transitive, allows one template to
52 // invoke another with a {{template}} action.
53 func (t *Template) New(name string) *Template {
55 nt := &Template{
65 func (t *Template) init() {
68 c.tmpl = make(map[string]*Template)
75 // Clone returns a duplicate of the template, including all associated
81 func (t *Template) Clone() (*Template, error) {
108 func (t *Template) copy(c *common) *Template {
117 // AddParseTree adds parse tree for template with given name and associates it with t.
118 // If the template does not already exist, it will create a new one.
119 // If the template does exist, it will be replaced.
120 func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) {
122 // If the name is the name of this template, overwrite this template.
137 func (t *Template) Templates() []*Template {
142 m := make([]*Template, 0, len(t.tmpl))
150 // subsequent calls to Parse, ParseFiles, or ParseGlob. Nested template
153 // The return value is the template, so calls can be chained.
154 func (t *Template) Delims(left, right string) *Template {
161 // Funcs adds the elements of the argument map to the template's function map.
163 // type or if the name cannot be used syntactically as a function in a template.
164 // It is legal to overwrite elements of the map. The return value is the template,
166 func (t *Template) Funcs(funcMap FuncMap) *Template {
175 // Lookup returns the template with the given name that is associated with t.
176 // It returns nil if there is no such template or the template has no definition.
177 func (t *Template) Lookup(name string) *Template {
184 // Parse parses text as a template body for t.
185 // Named template definitions ({{define ...}} or {{block ...}} statements) in text
190 // A template definition with a body containing only white space and comments
191 // is considered empty and will not replace an existing template's body.
192 // This allows using Parse to add new named template definitions without
193 // overwriting the main template body.
194 func (t *Template) Parse(text string) (*Template, error) {
211 // associate installs the new template into the group of templates associated
214 func (t *Template) associate(new *Template, tree *parse.Tree) (bool, error) {
219 // If a template by that name exists,
220 // don't replace it with an empty template.