Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for AddParseTree (0.51 sec)

  1. src/text/template/template.go

    		rightDelim: t.rightDelim,
    	}
    }
    
    // AddParseTree associates the argument parse tree with the template t, giving
    // it the specified name. If the template has not been defined, this tree becomes
    // its definition. If it has been defined and already has that name, the existing
    // definition is replaced; otherwise a new template is created, defined, and returned.
    func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:57:51 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  2. src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go

    	}
    
    	// Define a named template with specified contents.
    	def := func(name, contents string) {
    		sub := template.New(name)
    		template.Must(sub.Parse(contents))
    		template.Must(templates.AddParseTree(name, sub.Tree))
    	}
    
    	// Embedded files.
    	def("css", loadCSS("html/common.css"))
    	def("header", loadFile("html/header.html"))
    	def("graph", loadFile("html/graph.html"))
    	def("graph_css", loadCSS("html/graph.css"))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 31 19:48:28 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  3. src/html/template/template.go

    			tmpl = t.new(name)
    		}
    		tmpl.text = v
    		tmpl.Tree = v.Tree
    	}
    	return t, nil
    }
    
    // AddParseTree creates a new template with the name and parse tree
    // and associates it with t.
    //
    // It returns an error if t or any associated template has already been executed.
    func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) {
    	if err := t.checkCanParse(); err != nil {
    		return nil, err
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 21:00:46 UTC 2024
    - 17K bytes
    - Viewed (0)
  4. src/text/template/doc.go

    necessary to have a template addressable from multiple associations, the
    template definition must be parsed multiple times to create distinct *Template
    values, or must be copied with [Template.Clone] or [Template.AddParseTree].
    
    Parse may be called multiple times to assemble the various associated templates;
    see [ParseFiles], [ParseGlob], [Template.ParseFiles] and [Template.ParseGlob]
    for simple ways to parse related templates stored in files.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 24 21:59:12 UTC 2024
    - 17.9K bytes
    - Viewed (0)
  5. src/text/template/exec_test.go

    	}
    	// Add a non-empty template to check that the error is helpful.
    	tests, err := New("").Parse(testTemplates)
    	if err != nil {
    		t.Fatal(err)
    	}
    	tmpl.AddParseTree("secondary", tests.Tree)
    	err = tmpl.Execute(&b, 0)
    	if err == nil {
    		t.Fatal("expected second error")
    	}
    	got = err.Error()
    	want = `template: empty: "empty" is an incomplete or empty template`
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 22:23:55 UTC 2024
    - 60.1K bytes
    - Viewed (0)
  6. src/html/template/exec_test.go

    	}
    
    	// Add a non-empty template to check that the error is helpful.
    	tmpl = New("empty")
    	tests, err := New("").Parse(testTemplates)
    	if err != nil {
    		t.Fatal(err)
    	}
    	tmpl.AddParseTree("secondary", tests.Tree)
    	err = tmpl.Execute(&b, 0)
    	if err == nil {
    		t.Fatal("expected second error")
    	}
    	got = err.Error()
    	if got != want {
    		t.Errorf("expected error %s got %s", want, got)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 24 21:59:12 UTC 2024
    - 57.6K bytes
    - Viewed (0)
  7. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"String", Func, 19},
    	},
    	"html": {
    		{"EscapeString", Func, 0},
    		{"UnescapeString", Func, 0},
    	},
    	"html/template": {
    		{"(*Error).Error", Method, 0},
    		{"(*Template).AddParseTree", Method, 0},
    		{"(*Template).Clone", Method, 0},
    		{"(*Template).DefinedTemplates", Method, 6},
    		{"(*Template).Delims", Method, 0},
    		{"(*Template).Execute", Method, 0},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top