function stripHtml(text) { return String(text || '') .replace(/<[^>]+>/g, '') .trim(); } /** 去掉末尾 [doi] 等杂质,返回纯 DOI */ function cleanDoiString(raw) { let text = String(raw || '').trim(); if (!text) { return null; } text = text.replace(/\[doi\]$/i, '').trim(); text = text.replace(/[.,;)\]]+$/g, '').trim(); return text || null; } /** 从文献行数据中解析 DOI */ export function resolveReferenceDoi(row) { const candidates = [row && row.doilink, row && row.refer_doi, row && row.doi].filter(Boolean); for (let i = 0; i < candidates.length; i += 1) { const text = String(candidates[i]).trim(); if (!text) { continue; } const match = text.match(/10\.\d{4,9}\/[^\s\[]+/i); if (match) { return cleanDoiString(match[0]); } if (/^10\.\d/i.test(text)) { return cleanDoiString(text); } } return null; } /** 从 book 类型文献中解析 ISBN */ export function resolveReferenceIsbn(row) { const raw = String((row && row.isbn) || '').trim(); if (!raw) { return null; } const isbn13 = raw.match(/97[89][-\s.]?(?:\d[-\s.]?){9}[\dXx]/i); if (isbn13) { return isbn13[0].replace(/\s+/g, '-'); } const isbn10 = raw.match(/(?