Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
aui committed Jun 28, 2017
1 parent fd883ba commit b2895e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions lib/compile/adapter/rule.art.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* 简洁模板语法规则
*/
var artRule = {
test: /{{[ \t]*([@#]?)(\/?)([\w\W]*?)[ \t]*}}/,
test: /{{([@#]?)[ \t]*(\/?)([\w\W]*?)[ \t]*}}/,
use: function use(match, raw, close, code) {

var compiler = this;
var options = compiler.options;
var esTokens = compiler.getEsTokens(code.trim());
var esTokens = compiler.getEsTokens(code);
var values = esTokens.map(function (token) {
return token.value;
});
Expand Down Expand Up @@ -86,7 +86,9 @@ var artRule = {

case 'block':

code = 'block(' + values.join('').trim() + ',function(){';
group = artRule._split(esTokens);
group.shift();
code = 'block(' + group.join(',').trim() + ',function(){';
break;

case '/block':
Expand All @@ -113,7 +115,6 @@ var artRule = {

if (~values.indexOf('|')) {

// 解析过滤器
var v3split = ':'; // ... v3 compat ...

// 将过滤器解析成二维数组
Expand Down Expand Up @@ -157,7 +158,7 @@ var artRule = {
},

// 将多个 javascript 表达式拆分成组
// 支持基本运算、三元表达式、取值、运行函数
// 支持基本运算、三元表达式、取值、运行函数,不支持 `typeof value` 操作
// 只支持 string、number、boolean、null、undefined 这几种类型声明,不支持 function、object、array
_split: function _split(esTokens) {

Expand Down
4 changes: 2 additions & 2 deletions lib/compile/adapter/rule.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 原生模板语法规则
*/
var nativeRule = {
test: /<%(#?)((?:==|=#|[=-])?)([\w\W]*?)(-?)%>/,
test: /<%(#?)((?:==|=#|[=-])?)[ \t]*([\w\W]*?)[ \t]*(-?)%>/,
use: function use(match, comment, output, code /*, trimMode*/) {

output = {
Expand All @@ -18,7 +18,7 @@ var nativeRule = {

// ejs compat: comment tag
if (comment) {
code = '/*' + match + '*/';
code = '/*' + code + '*/';
output = false;
}

Expand Down
Loading

0 comments on commit b2895e1

Please sign in to comment.