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.
20 lines
919 B
20 lines
919 B
|
6 days ago
|
// 列出 u665(字段说明)中全部字段编号+名称,核对省略段是否还有客户相关字段
|
||
|
|
import fs from 'node:fs';
|
||
|
|
|
||
|
|
const html = fs.readFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/v29-customer-pages/a3-1-1-2-1_raw.html', 'utf8');
|
||
|
|
const decode = (s) => s.replace(/&#x([0-9A-Fa-f]+);/g, (_, h) => String.fromCodePoint(parseInt(h, 16)));
|
||
|
|
|
||
|
|
const m = html.match(/<div id="u665"[\s\S]*?id="u665_text"[\s\S]*?<\/div>\s*<\/div>/);
|
||
|
|
if (!m) { console.log('NOT FOUND'); process.exit(0); }
|
||
|
|
const paras = (m[0].match(/<p><span[^>]*>[\s\S]*?<\/span><\/p>/g) || [])
|
||
|
|
.map(p => decode(p.replace(/<\/?p>/g, '').replace(/<\/?span[^>]*>/g, '')).trim());
|
||
|
|
|
||
|
|
let cur = null;
|
||
|
|
for (const p of paras) {
|
||
|
|
const fm = p.match(/^(\d+)\.\s*(.+)$/);
|
||
|
|
if (fm) { cur = fm[1] + '. ' + fm[2]; console.log(cur); }
|
||
|
|
else if (cur && p.length > 0 && !p.startsWith(' ')) {
|
||
|
|
console.log(' ' + p.slice(0, 80));
|
||
|
|
}
|
||
|
|
}
|