Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for parseGlob (0.16 sec)

  1. src/text/template/helper.go

    // the last one mentioned will be the one that results.
    func (t *Template) ParseGlob(pattern string) (*Template, error) {
    	t.init()
    	return parseGlob(t, pattern)
    }
    
    // parseGlob is the implementation of the function and method ParseGlob.
    func parseGlob(t *Template, pattern string) (*Template, error) {
    	filenames, err := filepath.Glob(pattern)
    	if err != nil {
    		return nil, err
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:54:08 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  2. src/html/template/template.go

    // the last one mentioned will be the one that results.
    //
    // ParseGlob returns an error if t or any associated template has already been executed.
    func (t *Template) ParseGlob(pattern string) (*Template, error) {
    	return parseGlob(t, pattern)
    }
    
    // parseGlob is the implementation of the function and method ParseGlob.
    func parseGlob(t *Template, pattern string) (*Template, error) {
    	if err := t.checkCanParse(); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 21:00:46 UTC 2024
    - 17K bytes
    - Viewed (0)
  3. src/html/template/examplefiles_test.go

    	pattern := filepath.Join(dir, "*.tmpl")
    
    	// Here starts the example proper.
    	// T0.tmpl is the first name matched, so it becomes the starting template,
    	// the value returned by ParseGlob.
    	tmpl := template.Must(template.ParseGlob(pattern))
    
    	err := tmpl.Execute(os.Stdout, nil)
    	if err != nil {
    		log.Fatalf("template execution: %s", err)
    	}
    	// Output:
    	// T0 invokes T1: (T1 invokes T2: (This is T2))
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 09 19:12:23 UTC 2020
    - 7.5K bytes
    - Viewed (0)
  4. src/text/template/examplefiles_test.go

    	pattern := filepath.Join(dir, "*.tmpl")
    
    	// Here starts the example proper.
    	// T0.tmpl is the first name matched, so it becomes the starting template,
    	// the value returned by ParseGlob.
    	tmpl := template.Must(template.ParseGlob(pattern))
    
    	err := tmpl.Execute(os.Stdout, nil)
    	if err != nil {
    		log.Fatalf("template execution: %s", err)
    	}
    	// Output:
    	// T0 invokes T1: (T1 invokes T2: (This is T2))
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 09 19:12:23 UTC 2020
    - 6.1K bytes
    - Viewed (0)
  5. src/html/template/multi_test.go

    }
    
    func TestParseGlob(t *testing.T) {
    	_, err := ParseGlob("DOES NOT EXIST")
    	if err == nil {
    		t.Error("expected error for non-existent file; got none")
    	}
    	_, err = New("error").ParseGlob("[x")
    	if err == nil {
    		t.Error("expected error for bad pattern; got none")
    	}
    	template := New("root")
    	_, err = template.ParseGlob("testdata/file*.tmpl")
    	if err != nil {
    		t.Fatalf("error parsing files: %v", err)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:48:16 UTC 2022
    - 8K bytes
    - Viewed (0)
  6. src/text/template/multi_test.go

    }
    
    func TestParseGlob(t *testing.T) {
    	_, err := ParseGlob("DOES NOT EXIST")
    	if err == nil {
    		t.Error("expected error for non-existent file; got none")
    	}
    	_, err = New("error").ParseGlob("[x")
    	if err == nil {
    		t.Error("expected error for bad pattern; got none")
    	}
    	template := New("root")
    	_, err = template.ParseGlob("testdata/file*.tmpl")
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 08 10:48:29 UTC 2022
    - 11.7K bytes
    - Viewed (0)
  7. src/html/template/template_test.go

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

    		m = append(m, v)
    	}
    	return m
    }
    
    // Delims sets the action delimiters to the specified strings, to be used in
    // subsequent calls to [Template.Parse], [Template.ParseFiles], or [Template.ParseGlob]. Nested template
    // definitions will inherit the settings. An empty delimiter stands for the
    // corresponding default: {{ or }}.
    // The return value is the template, so calls can be chained.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:57:51 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  9. src/text/template/doc.go

    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.
    
    A template may be executed directly or through [Template.ExecuteTemplate], which executes
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 24 21:59:12 UTC 2024
    - 17.9K bytes
    - Viewed (0)
  10. cni/pkg/log/uds_test.go

    	i := 0
    	for _, l := range gotLogs {
    		var parsedLog map[string]any
    		assert.NoError(t, json.Unmarshal([]byte(l), &parsedLog))
    		if parsedLog["scope"] != "cni-plugin" {
    			// Each log is 2x: one direct, and one over UDS. Just test the UDS one
    			continue
    		}
    		// remove scope since it is constant and not needed to test
    		delete(parsedLog, "scope")
    		// check time is there
    		if _, f := parsedLog["time"]; !f {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Jun 12 16:26:28 UTC 2024
    - 4.1K bytes
    - Viewed (0)
Back to top