renamed foreach template token to each

This commit is contained in:
Borys Levytskyi
2015-04-12 13:36:08 +03:00
parent b9344c93ad
commit 31c611eb97
3 changed files with 4 additions and 4 deletions

View File

@@ -177,7 +177,7 @@
</script>
<script data-template="numbersList" data-compiled="" type="text/template">
<table class="expression">
{foreach op in m.operands}
{each op in m.operands}
<tr>
<td class="label">{op.input}</td>
<td class="bin">{op.bin.padLeft(m.bitsSize, '0')}</td>

View File

@@ -74,7 +74,7 @@
function replaceToken(token, indent) {
if(token.indexOf('foreach') == 0) {
if(token.indexOf('each') == 0) {
var r = /([\w\.]+)\sin\s([\w\.]+)/g;
var m = r.exec(token);
var v = m[1];

View File

@@ -8,8 +8,8 @@ describe('html templates', function () {
expect(compiled({name: 'test'})).toBe('<div>test</div>');
});
it('should support foreach', function () {
var t = '{foreach n in m.lst}{foreach c in m.lst2}{n}{c}{/}{/}';
it('should support each', function () {
var t = '{foreach n in m.lst}{each c in m.lst2}{n}{c}{/}{/}';
var compiled = html.compileTemplate(t);
var result = compiled({lst:[1,2,3], lst2:['a','b']});
console.log(result);