Commit 670c6c5c authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

common: UserData => UserVars

parent bbced21c
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
// elements and functions available. Plugin creators should process as // elements and functions available. Plugin creators should process as
// many fields as possible through this. // many fields as possible through this.
type Template struct { type Template struct {
UserData map[string]string UserVars map[string]string
root *template.Template root *template.Template
i int i int
...@@ -21,7 +21,7 @@ type Template struct { ...@@ -21,7 +21,7 @@ type Template struct {
// NewTemplate creates a new template processor. // NewTemplate creates a new template processor.
func NewTemplate() (*Template, error) { func NewTemplate() (*Template, error) {
result := &Template{ result := &Template{
UserData: make(map[string]string), UserVars: make(map[string]string),
} }
result.root = template.New("configTemplateRoot") result.root = template.New("configTemplateRoot")
...@@ -68,7 +68,7 @@ func (t *Template) nextTemplateName() string { ...@@ -68,7 +68,7 @@ func (t *Template) nextTemplateName() string {
// User is the function exposed as "user" within the templates and // User is the function exposed as "user" within the templates and
// looks up user variables. // looks up user variables.
func (t *Template) templateUser(n string) (string, error) { func (t *Template) templateUser(n string) (string, error) {
result, ok := t.UserData[n] result, ok := t.UserVars[n]
if !ok { if !ok {
return "", fmt.Errorf("uknown user var: %s", n) return "", fmt.Errorf("uknown user var: %s", n)
} }
......
...@@ -35,7 +35,7 @@ func TestTemplateProcess_user(t *testing.T) { ...@@ -35,7 +35,7 @@ func TestTemplateProcess_user(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
tpl.UserData["foo"] = "bar" tpl.UserVars["foo"] = "bar"
result, err := tpl.Process(`{{user "foo"}}`, nil) result, err := tpl.Process(`{{user "foo"}}`, nil)
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment