Merge branch 'v1.0'

Conflicts:
	package.json
This commit is contained in:
Patrick Steele-Idem 2014-05-08 23:22:02 -06:00
commit 54409d9e2e
2 changed files with 17 additions and 5 deletions

View File

@ -49,12 +49,15 @@ function Template(renderFunc) {
} }
Template.prototype = { Template.prototype = {
render: function(data, callback, context) { render: function(data, context) {
if (data == null) { if (data == null) {
data = {}; data = {};
} }
if (typeof callback === 'function') { var callback;
if (typeof context === 'function') {
callback = context;
context = new Context(); context = new Context();
context context
@ -67,11 +70,17 @@ Template.prototype = {
context.end(); context.end();
} else { } else {
var shouldEnd = false;
if (!context) {
context = new Context();
shouldEnd = true;
}
// A context object was provided instead of a callback // A context object was provided instead of a callback
context = callback;
callback = null;
this._(data, context); //Invoke the template rendering function with the required arguments this._(data, context); //Invoke the template rendering function with the required arguments
if (shouldEnd) {
context.end();
}
} }
return context; return context;

View File

@ -281,6 +281,9 @@ module.exports = function transform(node, compiler, template) {
}, },
'c-input': function(attr) { 'c-input': function(attr) {
inputAttr = attr.value; inputAttr = attr.value;
},
'c-data': function(attr) {
inputAttr = attr.value;
} }
}; };