Skip to content

Commit

Permalink
Add New function.
Browse files Browse the repository at this point in the history
  • Loading branch information
leekchan committed Jul 13, 2015
1 parent 09b1411 commit 969f557
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gtf.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ var GtfFuncMap = template.FuncMap {
return strings.ToLower(s)
},
}

func New(name string) *template.Template {
return template.New(name).Funcs(GtfFuncMap)
}
3 changes: 1 addition & 2 deletions gtf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package gtf
import (
"testing"
"bytes"
"html/template"
)

func AssertEqual(t *testing.T, buffer *bytes.Buffer, testString string) {
Expand All @@ -14,7 +13,7 @@ func AssertEqual(t *testing.T, buffer *bytes.Buffer, testString string) {
}

func ParseTest(buffer *bytes.Buffer, body string) {
tpl := template.New("test").Funcs(GtfFuncMap)
tpl := New("test").Funcs(GtfFuncMap)
tpl.Parse(body)
tpl.Execute(buffer, "")
}
Expand Down

0 comments on commit 969f557

Please sign in to comment.