diff --git a/lib/dust.js b/lib/dust.js index e08c756e..ed559c2f 100755 --- a/lib/dust.js +++ b/lib/dust.js @@ -619,9 +619,13 @@ Chunk.prototype.notexists = function(elem, context, bodies) { return this; }; -Chunk.prototype.block = function(elem, context, bodies) { +Chunk.prototype.block = function(elem, context, bodies, params) { var body = bodies.block; + if (params) { + context = context.push(params); + } + if (elem) { body = elem; } diff --git a/test/jasmine-test/spec/coreTests.js b/test/jasmine-test/spec/coreTests.js index 45578d02..7d803092 100755 --- a/test/jasmine-test/spec/coreTests.js +++ b/test/jasmine-test/spec/coreTests.js @@ -1188,6 +1188,58 @@ var coreTests = [ context: { "val1" : "title", "val2" : "A", "obj" : { "name" : ["A", "B"] } }, expected: "AAA", message: "should test blocks with dynamic key values as arrays" + }, + { + name: "blocks with inline parameters", + source: [ '{
', + '{/form}', + '', + '{+form url=dynamically_generated_url/}'].join("\n"), + context: { dynamically_generated_url: 'http://google.com/search'}, + expected: '', + message: "should test blocks with inline parameters" + }, + { + name: "blocks with inline parameters that reference objects", + source: [ '{