Skip to content
Browse files

Locals are passed to each tag callback.

  • Loading branch information...
1 parent 328c51b commit c9edc052255cee567bf43552593cfe5b29b93404 @sarenji committed Aug 28, 2012
Showing with 10 additions and 1 deletion.
  1. +1 −1 src/thermos.coffee
  2. +9 −0 test/templates.coffee
View
2 src/thermos.coffee
@@ -152,7 +152,7 @@ class ThermosContext
else
@text "<#{tagName}#{attrs}>"
if func?
- returned = func.call(this)
+ returned = func.call(this, @locals)
if typeOf(returned) is "String"
@text returned
@text
View
9 test/templates.coffee
@@ -128,6 +128,15 @@ describe 'a local variable', ->
email : "bob@example.com"
output : '<p class="left">Bob</p><p>bob@example.com</p>'
+ inner = (locals) -> locals.name
+ it 'gets passed to inner functions with a different closure', test
+ render: (locals) ->
+ @p inner
+ opts:
+ locals :
+ name : "Bob"
+ output : '<p>Bob</p>'
+
describe 'a basic template', ->
it "renders correctly", test
render : ->

0 comments on commit c9edc05

Please sign in to comment.
Something went wrong with that request. Please try again.