Skip to content

Commit

Permalink
Merge bc88b69 into 9d92fb9
Browse files Browse the repository at this point in the history
  • Loading branch information
winterTTr committed Nov 6, 2015
2 parents 9d92fb9 + bc88b69 commit 4a5856c
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions lib/extend/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,27 @@ NunjucksTag.prototype._parseArgs = function(parser, nodes, lexer) {
var args = [];
var token;

while ((token = parser.nextToken(true)) && token.type !== lexer.TOKEN_BLOCK_END) {
args += token.value;
var argarray = new nodes.Array(tag.lineno, tag.colno);

var argitem = "";
while( (token = parser.nextToken(true)) ){
if( token.type == lexer.TOKEN_WHITESPACE || token.type == lexer.TOKEN_BLOCK_END ){
if( argitem != "" ){
var argnode = new nodes.Literal(tag.lineno, tag.colno, argitem.trim());
argarray.addChild(argnode);
argitem = "";
}

if( token.type == lexer.TOKEN_BLOCK_END ){
break;
}
}
else {
argitem += token.value;
}
}

node.addChild(new nodes.Literal(token.lineno, token.colno, args.trim()));
node.addChild(argarray);

return node;
};
Expand All @@ -91,7 +107,7 @@ NunjucksTag.prototype.run = function(context, args) {
};

NunjucksTag.prototype._run = function(context, args, body) {
return this.fn.call(context.ctx, args.split(' '), body);
return this.fn.call(context.ctx, args, body);
};

function NunjucksBlock(name, fn) {
Expand Down

0 comments on commit 4a5856c

Please sign in to comment.