- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 321 for funcMap (0.13 sec)
-
src/text/template/examplefunc_test.go
// It installs the strings.Title function and uses it to // Make Title Text Look Good In Our Template's Output. func ExampleTemplate_func() { // First we create a FuncMap with which to register the function. funcMap := template.FuncMap{ // The name "title" is what the function will be called in the template text. "title": strings.Title, } // A simple template definition to test our function.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 08 04:08:51 UTC 2014 - 1.5K bytes - Viewed (0) -
cmd/gotemplate/gotemplate.go
var buf bytes.Buffer if _, err := buf.ReadFrom(in); err != nil { return fmt.Errorf("reading input: %v", err) } funcMap := template.FuncMap{ "include": include, "indent": indent, "trim": trim, } tmpl, err := template.New("").Funcs(funcMap).Parse(buf.String()) if err != nil { return fmt.Errorf("parsing input as text template: %v", err) }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Aug 22 18:39:23 UTC 2023 - 2.6K bytes - Viewed (0) -
src/text/template/template.go
// It is legal to overwrite elements of the map. The return value is the template, // so calls can be chained. func (t *Template) Funcs(funcMap FuncMap) *Template { t.init() t.muFuncs.Lock() defer t.muFuncs.Unlock() addValueFuncs(t.execFuncs, funcMap) addFuncs(t.parseFuncs, funcMap) return t } // Lookup returns the template with the given name that is associated with t.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Feb 26 20:57:51 UTC 2024 - 7.2K bytes - Viewed (0) -
pkg/bootstrap/instance.go
func newTemplate(templateFilePath string) (*template.Template, error) { cfgTmpl, err := os.ReadFile(templateFilePath) if err != nil { return nil, err } funcMap := template.FuncMap{ "toJSON": toJSON, } return template.New("bootstrap").Funcs(funcMap).Funcs(sprig.GenericFuncMap()).Parse(string(cfgTmpl))
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Thu Mar 28 20:38:02 UTC 2024 - 3.9K bytes - Viewed (0) -
src/text/template/example_test.go
func ExampleTemplate_block() { const ( master = `Names:{{block "list" .}}{{"\n"}}{{range .}}{{println "-" .}}{{end}}{{end}}` overlay = `{{define "list"}} {{join . ", "}}{{end}} ` ) var ( funcs = template.FuncMap{"join": strings.Join} guardians = []string{"Gamora", "Groot", "Nebula", "Rocket", "Star-Lord"} ) masterTmpl, err := template.New("master").Funcs(funcs).Parse(master) if err != nil { log.Fatal(err) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 29 00:17:40 UTC 2015 - 2.4K bytes - Viewed (0) -
staging/src/k8s.io/cli-runtime/pkg/printers/template.go
type GoTemplatePrinter struct { rawTemplate string template *template.Template } func NewGoTemplatePrinter(tmpl []byte) (*GoTemplatePrinter, error) { t, err := template.New("output"). Funcs(template.FuncMap{ "exists": exists, "base64decode": base64decode, }). Parse(string(tmpl)) if err != nil { return nil, err } return &GoTemplatePrinter{ rawTemplate: string(tmpl), template: t,
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Thu Mar 07 23:00:24 UTC 2019 - 3.4K bytes - Viewed (0) -
src/html/template/example_test.go
func ExampleTemplate_block() { const ( master = `Names:{{block "list" .}}{{"\n"}}{{range .}}{{println "-" .}}{{end}}{{end}}` overlay = `{{define "list"}} {{join . ", "}}{{end}} ` ) var ( funcs = template.FuncMap{"join": strings.Join} guardians = []string{"Gamora", "Groot", "Nebula", "Rocket", "Star-Lord"} ) masterTmpl, err := template.New("master").Funcs(funcs).Parse(master) if err != nil { log.Fatal(err) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 3.9K bytes - Viewed (0) -
pkg/config/schema/codegen/common.go
c.Stdout = os.Stdout c.Stderr = os.Stderr return c.Run() } func applyTemplate(tmpl string, i any) (string, error) { t := template.New("tmpl").Funcs(template.FuncMap{ "contains": strings.Contains, }) t2 := template.Must(t.Parse(tmpl)) var b bytes.Buffer if err := t2.Execute(&b, i); err != nil { return "", err } return b.String(), nil
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Sat Mar 30 00:31:03 UTC 2024 - 4.5K bytes - Viewed (0) -
src/crypto/md5/gen.go
a, b, c, d string Shift1 []int Shift2 []int Shift3 []int Shift4 []int Table1 []uint32 Table2 []uint32 Table3 []uint32 Table4 []uint32 } var funcs = template.FuncMap{ "dup": dup, "relabel": relabel, "rotate": rotate, "idx": idx, "seq": seq, } func dup(count int, x []int) []int { var out []int for i := 0; i < count; i++ {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 13 18:57:38 UTC 2024 - 4.7K bytes - Viewed (0) -
src/cmd/go/internal/help/help.go
w.err = err } return n, err } // tmpl executes the given template text on data, writing the result to w. func tmpl(w io.Writer, text string, data any) { t := template.New("top") t.Funcs(template.FuncMap{"trim": strings.TrimSpace, "capitalize": capitalize}) template.Must(t.Parse(text)) ew := &errWriter{w: w} err := t.Execute(ew, data) if ew.err != nil { // I/O error writing. Ignore write on closed pipe.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 03 18:15:22 UTC 2024 - 4.7K bytes - Viewed (0)