Skip to content

Commit

Permalink
use html filter default
Browse files Browse the repository at this point in the history
  • Loading branch information
erik168 committed Mar 9, 2013
1 parent 76c0a89 commit 49ddbfb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ define(
case EXPR_T.number:
return eval(expr.text);
case EXPR_T.variable:
return getVariableValue(scope, expr.text);
return getVariableValue(scope, expr.text, 'raw');
}
}
}());
Expand Down Expand Up @@ -1205,10 +1205,8 @@ define(
}

// 过滤处理
if (filterName) {
filterName = filterContainer[filterName.substr(1)];
filterName && (value = filterName(value));
}
var filter = filterContainer[filterName || 'html'];
filter && (value = filter(value));

return value;
}
Expand Down Expand Up @@ -1290,14 +1288,13 @@ define(
*/
function replaceVariable(text, scope) {
return text.replace(
/\$\{([.a-z0-9\[\]'"_]+)\s*(\|[a-z]+)?\s*\}/ig,
function($0, $1, $2) {
return getVariableValue(scope, $1, $2);
/\$\{([.a-z0-9\[\]'"_]+)\s*(\|([a-z]+))?\s*\}/ig,
function($0, $1, $2, $3) {
return getVariableValue(scope, $1, $3);
}
);
}


/**
* 执行import
*
Expand Down

0 comments on commit 49ddbfb

Please sign in to comment.