dustjs-linkedin
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -22,3 +22,3 @@ var dust = {}; | ||
var chunk = new Stub(callback).head; | ||
dust.load(name, chunk, Context.wrap(context)).end(); | ||
dust.load(name, chunk, Context.wrap(context, name)).end(); | ||
}; | ||
@@ -29,3 +29,3 @@ | ||
dust.nextTick(function() { | ||
dust.load(name, stream.head, Context.wrap(context)).end(); | ||
dust.load(name, stream.head, Context.wrap(context, name)).end(); | ||
}); | ||
@@ -44,3 +44,3 @@ return stream; | ||
dust.nextTick(function() { | ||
tmpl(master.head, Context.wrap(context)).end(); | ||
tmpl(master.head, Context.wrap(context, name)).end(); | ||
}); | ||
@@ -137,7 +137,9 @@ return master; | ||
Context.wrap = function(context) { | ||
Context.wrap = function(context, name) { | ||
if (context instanceof Context) { | ||
return context; | ||
} | ||
return new Context(new Stack(context)); | ||
var global= {}; | ||
global.__template_name__ = name; | ||
return new Context(new Stack(context), global); | ||
}; | ||
@@ -144,0 +146,0 @@ |
{ | ||
"name": "dustjs-linkedin", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"author": "Aleksander Williams", | ||
@@ -5,0 +5,0 @@ "description": "Asynchronous templates for the browser and node.js ( LinkedIn fork )", |
@@ -33,3 +33,17 @@ var coreTests = [ | ||
}, | ||
{ | ||
name: "global_template", | ||
source: '{#helper foo="bar" boo="boo"} {/helper}', | ||
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(context.global.__template_name__); } }, | ||
expected: "global_template", | ||
message: "should render the template name" | ||
}, | ||
{ | ||
name: "apps/test/foo.tl&v=0.1", | ||
source: '{#helper foo="bar" boo="boo" template="tl/apps/test"} {/helper}', | ||
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(context.global.__template_name__); } }, | ||
expected: "apps/test/foo.tl&v=0.1", | ||
message: "should render the template name with paths" | ||
}, | ||
{ | ||
name: "reference", | ||
@@ -36,0 +50,0 @@ source: "{?one}{one}{/one}", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1659529
36249