You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
976 B
17 lines
976 B
// 提取 a3-1-1-2-4 添加关联客户弹窗批注正文(内容单元格 u428/u431/u439/u447/u455/u463)
|
|
import fs from 'node:fs';
|
|
|
|
const html = fs.readFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/v29-customer-pages/a3-1-1-2-4_raw.html', 'utf8');
|
|
const decode = (s) => s
|
|
.replace(/&#x([0-9A-Fa-f]+);/g, (_, h) => String.fromCodePoint(parseInt(h, 16)))
|
|
.replace(/&#(\d+);/g, (_, d) => String.fromCodePoint(parseInt(d, 10)))
|
|
.replace(/ /g, ' ');
|
|
|
|
for (const id of ['u428', 'u431', 'u439', 'u447', 'u455', 'u463']) {
|
|
const m = html.match(new RegExp(`<div id="${id}"[\\s\\S]*?id="${id}_text"[\\s\\S]*?</div>\\s*</div>`));
|
|
if (!m) { console.log(`\n===== ${id}: NOT FOUND =====`); continue; }
|
|
const paras = (m[0].match(/<p><span[^>]*>[\s\S]*?<\/span><\/p>/g) || [])
|
|
.map(p => decode(p.replace(/<\/?p>/g, '').replace(/<\/?span[^>]*>/g, '')).trim())
|
|
.filter(p => p && p !== ' ');
|
|
console.log(`\n===== ${id} =====\n${paras.join('\n')}`);
|
|
}
|
|
|