From e7e7b62e13cae40b92a255d3b5d8e1768f96a11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Thu, 29 Jul 2021 14:23:01 +0800 Subject: [PATCH] update --- lib/tool.js | 10 ++++------ lib/tool.mjs | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/tool.js b/lib/tool.js index 05218c7..d11fb5f 100644 --- a/lib/tool.js +++ b/lib/tool.js @@ -17,15 +17,15 @@ class Tool { inc: 'include ([^\\{\\}\\(\\)]*?)', //引入其他文件 each: 'each ([^\\{\\}\\(\\)]*?)', //each循环开始 done: '/each', //each循环结束 - blockL: 'block ([^\\{\\}\\(\\)]*?)', //each循环开始 - blockR: '/block', //each循环结束 + blockL: 'block ([^\\{\\}\\(\\)]*?)', //block模块开始 + blockR: '/block', //block模块开始结束 if: 'if ([^\\{\\}\\/]*?)', //if开始 elif: 'elseif ([^\\{\\}\\/]*?)', //elseif开始 else: 'else', //else开始 fi: '/if', //if结束 var: 'var ([\\s\\S]*?)', //定义变量 echo: '=([^\\{\\}]*?)', //普通变量 - comment: '#([\\s\\S]*?)#' //引入其他文件 + comment: '#([\\s\\S]*?)#' //注释 } } @@ -278,9 +278,7 @@ class Tool { parseExtends(str) { let matches = str.match(/^/) if (!matches) { - str = str - .replace(this.__label__('blockL'), '') - .replace(this.__label__('blockR'), '') + str = str.replace(this.__label__('blockL'), '').replace(this.__label__('blockR'), '') } else { let blocks = {} // 去除所有的extends标签, 只允许有出现1次 diff --git a/lib/tool.mjs b/lib/tool.mjs index af20750..73ffabc 100644 --- a/lib/tool.mjs +++ b/lib/tool.mjs @@ -17,15 +17,15 @@ export default class Tool { inc: 'include ([^\\{\\}\\(\\)]*?)', //引入其他文件 each: 'each ([^\\{\\}\\(\\)]*?)', //each循环开始 done: '/each', //each循环结束 - blockL: 'block ([^\\{\\}\\(\\)]*?)', //each循环开始 - blockR: '/block', //each循环结束 + blockL: 'block ([^\\{\\}\\(\\)]*?)', //block模块开始 + blockR: '/block', //block模块开始结束 if: 'if ([^\\{\\}\\/]*?)', //if开始 elif: 'elseif ([^\\{\\}\\/]*?)', //elseif开始 else: 'else', //else开始 fi: '/if', //if结束 var: 'var ([\\s\\S]*?)', //定义变量 echo: '=([^\\{\\}]*?)', //普通变量 - comment: '#([\\s\\S]*?)#' //引入其他文件 + comment: '#([\\s\\S]*?)#' //注释 } } @@ -278,9 +278,7 @@ export default class Tool { parseExtends(str) { let matches = str.match(/^/) if (!matches) { - str = str - .replace(this.__label__('blockL'), '') - .replace(this.__label__('blockR'), '') + str = str.replace(this.__label__('blockL'), '').replace(this.__label__('blockR'), '') } else { let blocks = {} // 去除所有的extends标签, 只允许有出现1次