update
parent
d4f0918ca3
commit
e7e7b62e13
10
lib/tool.js
10
lib/tool.js
|
@ -17,15 +17,15 @@ class Tool {
|
||||||
inc: 'include ([^\\{\\}\\(\\)]*?)', //引入其他文件
|
inc: 'include ([^\\{\\}\\(\\)]*?)', //引入其他文件
|
||||||
each: 'each ([^\\{\\}\\(\\)]*?)', //each循环开始
|
each: 'each ([^\\{\\}\\(\\)]*?)', //each循环开始
|
||||||
done: '/each', //each循环结束
|
done: '/each', //each循环结束
|
||||||
blockL: 'block ([^\\{\\}\\(\\)]*?)', //each循环开始
|
blockL: 'block ([^\\{\\}\\(\\)]*?)', //block模块开始
|
||||||
blockR: '/block', //each循环结束
|
blockR: '/block', //block模块开始结束
|
||||||
if: 'if ([^\\{\\}\\/]*?)', //if开始
|
if: 'if ([^\\{\\}\\/]*?)', //if开始
|
||||||
elif: 'elseif ([^\\{\\}\\/]*?)', //elseif开始
|
elif: 'elseif ([^\\{\\}\\/]*?)', //elseif开始
|
||||||
else: 'else', //else开始
|
else: 'else', //else开始
|
||||||
fi: '/if', //if结束
|
fi: '/if', //if结束
|
||||||
var: 'var ([\\s\\S]*?)', //定义变量
|
var: 'var ([\\s\\S]*?)', //定义变量
|
||||||
echo: '=([^\\{\\}]*?)', //普通变量
|
echo: '=([^\\{\\}]*?)', //普通变量
|
||||||
comment: '#([\\s\\S]*?)#' //引入其他文件
|
comment: '#([\\s\\S]*?)#' //注释
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,9 +278,7 @@ class Tool {
|
||||||
parseExtends(str) {
|
parseExtends(str) {
|
||||||
let matches = str.match(/^<!--{extends ([^\\{\\}\\(\\)]*?)\s*?}-->/)
|
let matches = str.match(/^<!--{extends ([^\\{\\}\\(\\)]*?)\s*?}-->/)
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
str = str
|
str = str.replace(this.__label__('blockL'), '').replace(this.__label__('blockR'), '')
|
||||||
.replace(this.__label__('blockL'), '')
|
|
||||||
.replace(this.__label__('blockR'), '')
|
|
||||||
} else {
|
} else {
|
||||||
let blocks = {}
|
let blocks = {}
|
||||||
// 去除所有的extends标签, 只允许有出现1次
|
// 去除所有的extends标签, 只允许有出现1次
|
||||||
|
|
10
lib/tool.mjs
10
lib/tool.mjs
|
@ -17,15 +17,15 @@ export default class Tool {
|
||||||
inc: 'include ([^\\{\\}\\(\\)]*?)', //引入其他文件
|
inc: 'include ([^\\{\\}\\(\\)]*?)', //引入其他文件
|
||||||
each: 'each ([^\\{\\}\\(\\)]*?)', //each循环开始
|
each: 'each ([^\\{\\}\\(\\)]*?)', //each循环开始
|
||||||
done: '/each', //each循环结束
|
done: '/each', //each循环结束
|
||||||
blockL: 'block ([^\\{\\}\\(\\)]*?)', //each循环开始
|
blockL: 'block ([^\\{\\}\\(\\)]*?)', //block模块开始
|
||||||
blockR: '/block', //each循环结束
|
blockR: '/block', //block模块开始结束
|
||||||
if: 'if ([^\\{\\}\\/]*?)', //if开始
|
if: 'if ([^\\{\\}\\/]*?)', //if开始
|
||||||
elif: 'elseif ([^\\{\\}\\/]*?)', //elseif开始
|
elif: 'elseif ([^\\{\\}\\/]*?)', //elseif开始
|
||||||
else: 'else', //else开始
|
else: 'else', //else开始
|
||||||
fi: '/if', //if结束
|
fi: '/if', //if结束
|
||||||
var: 'var ([\\s\\S]*?)', //定义变量
|
var: 'var ([\\s\\S]*?)', //定义变量
|
||||||
echo: '=([^\\{\\}]*?)', //普通变量
|
echo: '=([^\\{\\}]*?)', //普通变量
|
||||||
comment: '#([\\s\\S]*?)#' //引入其他文件
|
comment: '#([\\s\\S]*?)#' //注释
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,9 +278,7 @@ export default class Tool {
|
||||||
parseExtends(str) {
|
parseExtends(str) {
|
||||||
let matches = str.match(/^<!--{extends ([^\\{\\}\\(\\)]*?)\s*?}-->/)
|
let matches = str.match(/^<!--{extends ([^\\{\\}\\(\\)]*?)\s*?}-->/)
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
str = str
|
str = str.replace(this.__label__('blockL'), '').replace(this.__label__('blockR'), '')
|
||||||
.replace(this.__label__('blockL'), '')
|
|
||||||
.replace(this.__label__('blockR'), '')
|
|
||||||
} else {
|
} else {
|
||||||
let blocks = {}
|
let blocks = {}
|
||||||
// 去除所有的extends标签, 只允许有出现1次
|
// 去除所有的extends标签, 只允许有出现1次
|
||||||
|
|
Loading…
Reference in New Issue