Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for AddParseTree (0.19 sec)

  1. src/html/template/template_test.go

    		t.Errorf("ParseGlob: %v\nwanted error about already having Executed", err)
    	}
    	if _, err := c.root.AddParseTree("t1", c.root.Tree); err == nil || !strings.Contains(err.Error(), "Execute") {
    		t.Errorf("AddParseTree: %v\nwanted error about already having Executed", err)
    	}
    }
    
    func TestNumbers(t *testing.T) {
    	c := newTestCase(t)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:48:16 UTC 2022
    - 6.2K bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. src/html/template/multi_test.go

    	tmpl := New("master")
    	tree, err := parse.Parse("master", master, "", "", nil)
    	if err != nil {
    		t.Fatalf("unexpected parse err: %v", err)
    	}
    	masterTree := tree["master"]
    	tmpl.AddParseTree("master", masterTree) // used to panic
    }
    
    func TestRedefinition(t *testing.T) {
    	var tmpl *Template
    	var err error
    	if tmpl, err = New("tmpl1").Parse(`{{define "test"}}foo{{end}}`); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:48:16 UTC 2022
    - 8K bytes
    - Viewed (0)
  5. src/html/template/clone_test.go

    	tree, err := parse.Parse("t", `{{define "b"}}<a href="{{end}}`, "", "", nil, nil)
    	if err != nil {
    		t.Fatal(err)
    	}
    	added := Must(root.AddParseTree("b", tree["b"]))
    	b := new(strings.Builder)
    	err = added.ExecuteTemplate(b, "a", "1>0")
    	if err != nil {
    		t.Fatal(err)
    	}
    	if got, want := b.String(), ` 1&gt;0 <a href=" 1%3e0 "></a>`; got != want {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:48:16 UTC 2022
    - 8K bytes
    - Viewed (0)
Back to top