Comparing version 0.3.1 to 0.4.0
{ | ||
"name": "yog-swig", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "custom swig template, add some tag or filter ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,3 +16,3 @@ var exports = module.exports; | ||
exports.compile = function(compiler, args, content, parents, options, blockName) { | ||
var code = '_ctx._yog.load(' + args.pop() + ');' | ||
var code = '_ctx._yog.load(' + args[0] + ', ' + args[1] + ');' | ||
return code; | ||
@@ -23,8 +23,14 @@ }; | ||
parser.on(types.STRING, function (token) { | ||
var self = this; | ||
self.out.push(token.match); | ||
this.out.unshift(token.match); | ||
}); | ||
parser.on(types.VAR, function (token) { | ||
if (token.match === 'external') { | ||
this.out.push(true); | ||
}else { | ||
this.out.unshift('_ctx.' + token.match); | ||
} | ||
}); | ||
return true; | ||
}; | ||
exports.ends = false; | ||
exports.ends = false; |
24023
613