mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-10 06:52:05 +01:00
renamed foreach template token to each
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user