mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Make {{#if content}} work.
This lets you check whether a template was invoked via inclusion or as a block helper. An example is the api_box template in docs.
This commit is contained in:
@@ -302,6 +302,14 @@ var codeGenMustache = function (tag, mustacheType) {
|
||||
//
|
||||
// No code is generated to call the result if it's a function.
|
||||
var codeGenPath = function (path) {
|
||||
// Let {{#if content}} check whether this template was invoked via
|
||||
// inclusion or as a block helper.
|
||||
if (builtInComponents.hasOwnProperty(path[0])) {
|
||||
if (path.length > 1)
|
||||
throw new Error("Unexpected dotted path beginning with " + path[0]);
|
||||
return builtInComponents[path[0]];
|
||||
}
|
||||
|
||||
var code = 'self.lookup(' + toJSLiteral(path[0]) + ')';
|
||||
|
||||
if (path.length > 1) {
|
||||
|
||||
Reference in New Issue
Block a user