- Sort Score
- Result 10 results
- Languages All
Results 1 - 9 of 9 for AddParseTree (0.2 sec)
-
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) -
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) -
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) -
src/html/template/escape.go
insertedIdents[normalizeEscFn(idNode.Ident)] = true } } for _, name := range s { if !insertedIdents[normalizeEscFn(name)] { // When two templates share an underlying parse tree via the use of // AddParseTree and one template is executed after the other, this check // ensures that escapers that were already inserted into the pipeline on // the first escaping pass do not get inserted again.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 02 15:18:39 UTC 2023 - 32.4K bytes - Viewed (0) -
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) -
src/html/template/escape_test.go
data = `<baz>` want = `<baz>` ) // Templates "foo" and "bar" both alias the same underlying parse tree. tpl := Must(New("foo").Parse(tmplText)) if _, err := tpl.AddParseTree("bar", tpl.Tree); err != nil { t.Fatalf("AddParseTree error: %v", err) } var b1, b2 strings.Builder if err := tpl.ExecuteTemplate(&b1, "foo", data); err != nil { t.Fatalf(`ExecuteTemplate failed for "foo": %v`, err) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 16 03:29:27 UTC 2023 - 56.2K bytes - Viewed (0) -
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) -
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) -
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)