Skip to content

Commit

Permalink
contentFor behavior changed fixes #39
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jan 20, 2018
1 parent a278059 commit 0d7698b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion content_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

// ContentFor stores a block of templating code to be re-used later in the template.
/*
<%= contentFor("buttons") { %>
<% contentFor("buttons") { %>
<button>hi</button>
<% } %>
*/
Expand Down
9 changes: 4 additions & 5 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,16 @@ func NewContext() *Context {
func NewContextWith(data map[string]interface{}) *Context {
c := &Context{
Context: context.Background(),
data: map[string]interface{}{},
data: data,
outer: nil,
moot: &sync.Mutex{},
}
for k, v := range Helpers.helpers {
c.Set(k, v)
if !c.Has(k) {
c.Set(k, v)
}
}

for k, v := range data {
c.Set(k, v)
}
return c
}

Expand Down

0 comments on commit 0d7698b

Please sign in to comment.