Skip to content

Commit

Permalink
whtmpl: makeslice
Browse files Browse the repository at this point in the history
  • Loading branch information
jtolio committed Jan 8, 2017
1 parent b6e4ec9 commit c8344fc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions whtmpl/tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ type Pair struct {
// A template collection by default has two additional helper functions defined
// within templates:
//
// * makepair: creates a Pair type of its two given arguments
// * makemap: creates a map out of the even number of arguments given.
// * makepair: creates a Pair type of its two given arguments.
// * makeslice: creates a slice of the given arguments.
// * safeurl: calls template.URL with its first argument and returns the
// result
// result.
//
type Collection struct {
group *template.Template
Expand All @@ -82,7 +83,8 @@ func NewCollection() *Collection {
"makepair": func(first, second interface{}) Pair {
return Pair{First: first, Second: second}
},
"makemap": makemap,
"makemap": makemap,
"makeslice": func(args ...interface{}) []interface{} { return args },
"safeurl": func(val string) template.URL {
return template.URL(val)
},
Expand Down

0 comments on commit c8344fc

Please sign in to comment.