Golang html/template.Template.Delims function examples

package html/template

Delims sets the action delimiters to the specified strings, to be used in subsequent calls to Parse, ParseFiles, or 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.

Golang html/template.Template.Delims function usage examples

Example 1:

 rev := template.New("")
 rev.Delims("<#", "#>")

Example 2:

 t := template.Must(template.New("template").Delims("*(", ")*").Parse(srcString))

Reference :

http://golang.org/pkg/html/template/#Template.Delims

Advertisement