velocityjs
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "velocityjs", | ||
"description": "Velocity Template Language(VTL) for JavaScript", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "velocity template" |
@@ -128,4 +128,4 @@ module.exports = function(Velocity, utils){ | ||
this.local[contextId] = {}; | ||
this.conditions.pop(); | ||
this.condition = ''; | ||
this.conditions.shift(); | ||
this.condition = this.conditions[0] || ''; | ||
@@ -132,0 +132,0 @@ return ret; |
@@ -499,4 +499,22 @@ var Velocity = require('../src/velocity') | ||
it('eval work with #set', function(){ | ||
//这一句非常重要,在node端无需处理,web端必须如此声明 | ||
Compile.Parser = Parser | ||
var macros = { | ||
cmsparse: function(str){ | ||
return this.eval(str) | ||
} | ||
} | ||
var vm = '#cmsparse($str)' | ||
var o = { | ||
str: '#set($foo = ["hello"," ", "world"])#foreach($word in $foo)$word#end' | ||
} | ||
assert.equal('hello world', render(vm, o, macros)) | ||
}) | ||
}) | ||
describe('self defined function', function() { | ||
@@ -503,0 +521,0 @@ |
423589
3869