提交
This commit is contained in:
@@ -349,7 +349,7 @@ export default {
|
||||
}
|
||||
// 如果连续数字 >= 3 个,使用连字符 '-'
|
||||
if (j - i >= 2) {
|
||||
result.push(`${sorted[i]}-${sorted[j]}`);
|
||||
result.push(`${sorted[i]}–${sorted[j]}`);
|
||||
} else {
|
||||
// 否则(1个或2个)逐个列出
|
||||
for (let k = i; k <= j; k++) {
|
||||
@@ -368,11 +368,19 @@ export default {
|
||||
let html = this.highlightText2(text, annotations, type, am_id);
|
||||
|
||||
// 2. 借鉴 EndNote:对处理完批注的 HTML 进行引用联动渲染
|
||||
// 正则匹配连续的 autocite 标签(允许中间有空格)
|
||||
const citeGroupRe = /(<autocite\s+data-id="(\d+)"\s*><\/autocite>\s*)+/gi;
|
||||
// 支持 data-id="a,b,c" 单标签 或 多个相邻单 id 标签
|
||||
const citeGroupRe = /(?:<autocite\s+data-id="([^"]+)"\s*><\/autocite>\s*)+/gi;
|
||||
|
||||
return html.replace(citeGroupRe, (groupMatch) => {
|
||||
const ids = [...groupMatch.matchAll(/data-id="(\d+)"/gi)].map((m) => m[1]);
|
||||
const ids = [];
|
||||
const innerRe = /<autocite\s+data-id="([^"]+)"\s*><\/autocite>/gi;
|
||||
let m;
|
||||
while ((m = innerRe.exec(groupMatch)) !== null) {
|
||||
m[1].split(',').forEach((part) => {
|
||||
const id = part.trim();
|
||||
if (id) ids.push(id);
|
||||
});
|
||||
}
|
||||
|
||||
// 从全局 citeMap 中获取序号(citeMap 是你根据全文顺序生成的 {ID: Index})
|
||||
const nums = ids.map((id) => this.citeMap[id]).filter((n) => n);
|
||||
@@ -1876,9 +1884,9 @@ export default {
|
||||
border-radius: 30px;
|
||||
}
|
||||
.text-highlight {
|
||||
background-color: rgb(252, 98, 93);
|
||||
/* background-color: rgb(252, 98, 93);
|
||||
background-color: rgb(252 98 93 / 68%);
|
||||
color: #333;
|
||||
color: #333; */
|
||||
}
|
||||
.template-info {
|
||||
margin-top: 20px;
|
||||
|
||||
Reference in New Issue
Block a user