审稿人证书生成

This commit is contained in:
2026-07-10 09:12:09 +08:00
parent 262e634f85
commit 3448ffe961
29 changed files with 7825 additions and 492 deletions

View File

@@ -7,6 +7,7 @@ import { MathfieldElement } from 'mathlive';
import 'mathlive/dist/mathlive-static.css';
import 'mathlive/dist/mathlive-fonts.css';
import { importWordDocumentWithMath as parseWordDocumentWithMath, parseHtmlToLatex as convertHtmlToLatex, postProcessImportedWordHtml, parseImportedHtmlToContentRows, mergeAdjacentBlueTags, normalizeSpacesAroundBlueTags } from '@/utils/wordMathImport';
import { wrapReferenceHighlightsInBlueHtml } from '@/utils/manuscriptMediaReferences';
import api from '../../api/index.js';
import Common from '@/components/common/common'
import Tiff from 'tiff.js';
@@ -852,32 +853,8 @@ export default {
// 首字母大写
str = capitalizeFirstLetter(str);
// 添加蓝色标签
// 1. 修改正则,只匹配不在 <blue> 标签内的 [数字]
// 这里的思路是:匹配 [内容],但通过逻辑过滤掉已经被包裹的情况
const regex = /\[(\d+(?:\d+)?(?:, ?\d+(?:\d+)?)*)\]/g;
// 注意:不要在最上面执行 str.replace(/<blue>/g, ''),否则之前的标记就全白做了
str = str.replace(regex, function (match, content, offset, fullString) {
// 【关键判断】:检查匹配位置的前后,是否已经存在 <blue> 和 </blue>
const prefix = fullString.substring(offset - 6, offset); // <blue> 是 6 位
const suffix = fullString.substring(offset + match.length, offset + match.length + 7); // </blue> 是 7 位
if (prefix === '<blue>' && suffix === '</blue>') {
return match; // 如果已经有标签了,原样返回,不重复标记
}
// 判断逻辑:纯数字、逗号空格、连字符
if (/^\d+$/.test(content) || /, ?/.test(content) || //.test(content)) {
return `<blue>${match}</blue>`;
}
return match;
});
// 添加蓝色标签:参考文献标号 + Figure/Table 引用
str = wrapReferenceHighlightsInBlueHtml(str);
return str;
@@ -1581,6 +1558,7 @@ str = str.replace(regex, function (match, content, offset, fullString) {
text = text.replace(/<[^\/>]+>\s*<\/[^>]+>/gi, (match) => (match.trim() === '' ? '' : match));
text = mergeAdjacentBlueTags(text);
text = normalizeSpacesAroundBlueTags(text);
text = wrapReferenceHighlightsInBlueHtml(text);
parsedData.push(text.trim() === '' ? '' : text);
});