From 0967ac20ded7430a4560d5b50d54a1fdf7ab0282 Mon Sep 17 00:00:00 2001 From: Amos Date: Wed, 7 Aug 2024 13:24:31 +0800 Subject: [PATCH] Fix: translator - gulpfile.js --- tool/translator/gulpfile.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tool/translator/gulpfile.js b/tool/translator/gulpfile.js index a6f3028ba..f10b40733 100644 --- a/tool/translator/gulpfile.js +++ b/tool/translator/gulpfile.js @@ -4,6 +4,11 @@ const replace = require('gulp-replace'); // 为了翻译工具能正确匹配, // 需要为一些结构格式做出调整。 +// 适用路径 +const gulpSrc = [ + '../../_site/**/!(*_cn).html', +]; + // 去掉中文标点与中文间的空格 gulp.task('remove-space', () => { return gulp.src(['../../_site/**/*.html']) @@ -18,7 +23,7 @@ gulp.task('mark-side-toc', () => { // 移动端显示屏顶部目录 正则匹配 const mobileRegexp = /
  • \s*(?!.*[\u4e00-\u9fa5])(.*?)<\/a>\s*<\/li>\s*
  • \s*(?=.*[\u4e00-\u9fa5])(.*?)<\/a>/g; - return gulp.src(['../../_site/**/*.html']) + return gulp.src(gulpSrc) // 宽显示屏右侧目录 .pipe( replace(wideRegexp, (match, p1, p2, p3, p4) => { @@ -39,29 +44,29 @@ gulp.task('mark-side-toc', () => { // 匹配替换正文分级标题相关格式 gulp.task('mark-side-level-title', () => { // 正文分级标题 正则匹配 - const titleRegexp = /