Skip to content

Commit

Permalink
修正 if 字符串表达式
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Jun 20, 2016
1 parent bc2cd1b commit 89b0bb0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blear.classes.template",
"version": "1.0.20",
"version": "1.0.21",
"description": "指令类型模板引擎",
"scripts": {
"live": "browser-sync start --config bs-config.js",
Expand Down
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,15 @@ pro[_STATEMENT_OPEN] = function () {
token = the[_next]();

while (token.type !== 'END') {
values.push(token.value);
var _value = token.value;

switch (token.type) {
case 'STRING':
_value = textify(_value);
break;
}

values.push(_value);
token = the[_next]();
}

Expand Down
2 changes: 1 addition & 1 deletion test/test.index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('测试文件', function () {
});

it('#if', function (done) {
var str1 = '{{#if varible}}if{{/if}}';
var str1 = '{{#if varible === "<b>"}}if{{/if}}';
var tpl = new Template(str1);
var data = {
varible: '<b>'
Expand Down

0 comments on commit 89b0bb0

Please sign in to comment.