- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 11 for ExecuteTemplate (0.59 sec)
-
src/html/template/escape_test.go
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) } if err := tpl.ExecuteTemplate(&b2, "bar", data); err != nil { t.Fatalf(`ExecuteTemplate failed for "foo": %v`, err) } got1, got2 := b1.String(), b2.String() if got1 != want {
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/html/template/doc.go
err = t.ExecuteTemplate(out, "T", "<script>alert('you have been pwned')</script>") produces Hello, <script>alert('you have been pwned')</script>! but the contextual autoescaping in html/template import "html/template" ... t, err := template.New("foo").Parse(`{{define "T"}}Hello, {{.}}!{{end}}`) err = t.ExecuteTemplate(out, "T", "<script>alert('you have been pwned')</script>")
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 22 18:04:29 UTC 2024 - 7.9K bytes - Viewed (0) -
src/text/template/helper.go
// name of one of the (base) names of the files. If it does not, depending on // t's contents before calling ParseFiles, t.Execute may fail. In that // case use t.ExecuteTemplate to execute a valid template. // // When parsing multiple files with the same name in different directories, // the last one mentioned will be the one that results.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 21:54:08 UTC 2024 - 6.4K bytes - Viewed (0) -
src/html/template/exec_test.go
t.Fatal("exec error:", err) } result := b.String() if result != expect { t.Errorf("expected %q got %q", expect, result) } // Then direct to execution. b.Reset() err = tmpl.ExecuteTemplate(&b, "tree", tree) if err != nil { t.Fatal("exec error:", err) } result = b.String() if result != expect { t.Errorf("expected %q got %q", expect, result) } }
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/html/template/template.go
func (t *Template) Execute(wr io.Writer, data any) error { if err := t.escape(); err != nil { return err } return t.text.Execute(wr, data) } // ExecuteTemplate applies the template associated with t that has the given // name to the specified data object and writes the output to wr. // If an error occurs executing the template or writing its output,
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Mar 21 21:00:46 UTC 2024 - 17K bytes - Viewed (0) -
src/text/template/doc.go
A template may be executed directly or through [Template.ExecuteTemplate], which executes an associated template identified by name. To invoke our example above, we might write, err := tmpl.Execute(os.Stdout, "no data needed") if err != nil { log.Fatalf("execution failed: %s", err) } or to invoke a particular template explicitly by name, err := tmpl.ExecuteTemplate(os.Stdout, "T2", "no data needed") if err != nil {
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/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
profile := getFromLegend(legend, "Type: ", "unknown") data.Title = file + " " + profile data.Errors = errList data.Total = rpt.Total() data.Legend = legend return getHTMLTemplates().ExecuteTemplate(dst, tmpl, data) } // render responds with html generated by passing data to the named template. func (ui *webInterface) render(w http.ResponseWriter, req *http.Request, tmpl string,
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 31 19:48:28 UTC 2024 - 14K bytes - Viewed (0) -
src/text/template/exec.go
panic(e) case writeError: *errp = err.Err // Strip the wrapper. case ExecError: *errp = err // Keep the wrapper. default: panic(e) } } } // ExecuteTemplate applies the template associated with t that has the given name // to the specified data object and writes the output to wr. // If an error occurs executing the template or writing its output,
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 24 21:22:24 UTC 2024 - 32K bytes - Viewed (0) -
pilot/pkg/xds/bench_test.go
configName = input.Name } tmpl := template.Must(template.New("").Funcs(sprig.TxtFuncMap()).ParseFiles(path.Join("testdata", "benchmarks", configName+".yaml"))) var buf bytes.Buffer if err := tmpl.ExecuteTemplate(&buf, configName+".yaml", input); err != nil { t.Fatalf("failed to execute template: %v", err) } extra := path.Join("testdata", "benchmarks", configName+".extra.yaml") inputYAML := buf.String()
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Mon Apr 22 18:13:40 UTC 2024 - 19.7K bytes - Viewed (0) -
src/text/template/exec_test.go
t.Fatal("exec error:", err) } result := b.String() if result != expect { t.Errorf("expected %q got %q", expect, result) } // Then direct to execution. b.Reset() err = tmpl.ExecuteTemplate(&b, "tree", tree) if err != nil { t.Fatal("exec error:", err) } result = b.String() if result != expect { t.Errorf("expected %q got %q", expect, result) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 24 22:23:55 UTC 2024 - 60.1K bytes - Viewed (0)