Lines Matching full:template
5 package template
11 "text/template/parse"
16 tmpl map[string]*Template // Map from name to defined templates.
26 // Template is the representation of a parsed template. The *parse.Tree
27 // field is exported only for use by html/template and should be treated
29 type Template struct {
37 // New allocates a new, undefined template with the given name.
38 func New(name string) *Template {
39 t := &Template{
46 // Name returns the name of the template.
47 func (t *Template) Name() string {
51 // New allocates a new, undefined template associated with the given one and with the same
52 // delimiters. The association, which is transitive, allows one template to
53 // invoke another with a {{template}} action.
54 func (t *Template) New(name string) *Template {
56 nt := &Template{
66 func (t *Template) init() {
69 c.tmpl = make(map[string]*Template)
76 // Clone returns a duplicate of the template, including all associated
82 func (t *Template) Clone() (*Template, error) {
109 func (t *Template) copy(c *common) *Template {
118 // AddParseTree adds parse tree for template with given name and associates it with t.
119 // If the template does not already exist, it will create a new one.
120 // It is an error to reuse a name except to overwrite an empty template.
121 func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) {
123 // If the name is the name of this template, overwrite this template.
139 func (t *Template) Templates() []*Template {
144 m := make([]*Template, 0, len(t.tmpl))
152 // subsequent calls to Parse, ParseFiles, or ParseGlob. Nested template
155 // The return value is the template, so calls can be chained.
156 func (t *Template) Delims(left, right string) *Template {
163 // Funcs adds the elements of the argument map to the template's function map.
166 // value is the template, so calls can be chained.
167 func (t *Template) Funcs(funcMap FuncMap) *Template {
176 // Lookup returns the template with the given name that is associated with t.
177 // It returns nil if there is no such template or the template has no definition.
178 func (t *Template) Lookup(name string) *Template {
185 // Parse defines the template by parsing the text. Nested template definitions will be
186 // associated with the top-level template t. Parse may be called multiple times
188 // resulting template is non-empty (contains content other than template
189 // definitions) and would replace a non-empty template with the same name.
190 // (In multiple calls to Parse with the same receiver template, only one call
191 // can contain text other than space, comments, and template definitions.)
192 func (t *Template) Parse(text string) (*Template, error) {
209 // associate installs the new template into the group of templates associated
211 // template. The two are already known to share the common structure.
213 func (t *Template) associate(new *Template, tree *parse.Tree) (bool, error) {
226 return false, fmt.Errorf("template: redefinition of template %q", name)