判断wxml中代码段的正则表达式纠正
This commit is contained in:
parent
478c945e57
commit
d76abf341c
|
|
@ -119,7 +119,7 @@ function codeChunkIncludesT(text) {
|
|||
* @returns
|
||||
*/
|
||||
function transformCode(text, namespace, moduleName) {
|
||||
const codeChunkRegex = /{{((\w|\W)*)}}/g;
|
||||
const codeChunkRegex = /(?:\{\{|%\{)(.*?)(?:\}\}?)/gm;
|
||||
const matches = text.match(codeChunkRegex);
|
||||
if (!matches) {
|
||||
return text;
|
||||
|
|
|
|||
4
test.js
4
test.js
|
|
@ -9,7 +9,7 @@ function codeChunkIncludesT(text) {
|
|||
}
|
||||
|
||||
function transformCode(text, namespace, moduleName) {
|
||||
const codeChunkRegex = /{{((\w|\W)*)}}/g;
|
||||
const codeChunkRegex = /(?:\{\{|%\{)(.*?)(?:\}\}?)/gm;
|
||||
const matches = text.match(codeChunkRegex);
|
||||
if (!matches) {
|
||||
return text;
|
||||
|
|
@ -89,5 +89,5 @@ function getProjectPath(filepath) {
|
|||
}
|
||||
|
||||
|
||||
console.log(transformCode('{{abc + t("abd")}}', 'ns', 'module'));
|
||||
console.log(transformCode("只显示{{t('house')}}和{{t('house')}}", 'ns', 'module'));
|
||||
// console.log(getProjectPath('D:\\git\\taicang\\src\\pages\\home\\index.xml'));
|
||||
Loading…
Reference in New Issue