Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 537 for funcMap (0.25 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. src/text/template/funcs.go

    }
    
    // createValueFuncs turns a FuncMap into a map[string]reflect.Value
    func createValueFuncs(funcMap FuncMap) map[string]reflect.Value {
    	m := make(map[string]reflect.Value)
    	addValueFuncs(m, funcMap)
    	return m
    }
    
    // addValueFuncs adds to values the functions in funcs, converting them to reflect.Values.
    func addValueFuncs(out map[string]reflect.Value, in FuncMap) {
    	for name, fn := range in {
    		if !goodName(name) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 22:23:55 UTC 2024
    - 20.9K bytes
    - Viewed (0)
  6. src/sort/gen_sort_variants.go

    	//      `j` of the value `name`.
    	Funcs template.FuncMap
    }
    
    var (
    	traditionalVariants = []Variant{
    		Variant{
    			Name:       "interface",
    			Path:       "zsortinterface.go",
    			Package:    "sort",
    			Imports:    "",
    			FuncSuffix: "",
    			TypeParam:  "",
    			ExtraParam: "",
    			ExtraArg:   "",
    			DataType:   "Interface",
    			Funcs: template.FuncMap{
    				"Less": func(name, i, j string) string {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:27 UTC 2023
    - 19.6K bytes
    - Viewed (0)
  7. src/html/template/template.go

    // type. However, 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.text.Funcs(template.FuncMap(funcMap))
    	return t
    }
    
    // Delims sets the action delimiters to the specified strings, to be used in
    // subsequent calls to [Template.Parse], [ParseFiles], or [ParseGlob]. Nested template
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 21:00:46 UTC 2024
    - 17K bytes
    - Viewed (0)
  8. 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)
  9. src/html/template/escape.go

    			return s
    		}
    	}
    	for i, arg := range args {
    		args[i] = indirectToStringerOrError(arg)
    	}
    	return fmt.Sprint(args...)
    }
    
    // funcMap maps command names to functions that render their inputs safe.
    var funcMap = template.FuncMap{
    	"_html_template_attrescaper":      attrEscaper,
    	"_html_template_commentescaper":   commentEscaper,
    	"_html_template_cssescaper":       cssEscaper,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 02 15:18:39 UTC 2023
    - 32.4K bytes
    - Viewed (0)
  10. pkg/kube/inject/template.go

    	"istio.io/istio/pkg/config/mesh"
    	"istio.io/istio/pkg/log"
    	"istio.io/istio/pkg/util/protomarshal"
    )
    
    var InjectionFuncmap = createInjectionFuncmap()
    
    func createInjectionFuncmap() template.FuncMap {
    	return template.FuncMap{
    		"formatDuration":      formatDuration,
    		"isset":               isset,
    		"excludeInboundPort":  excludeInboundPort,
    		"includeInboundPorts": includeInboundPorts,
    		"kubevirtInterfaces":  kubevirtInterfaces,
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Nov 16 02:12:03 UTC 2023
    - 9.9K bytes
    - Viewed (0)
Back to top