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.
29 lines
1.2 KiB
29 lines
1.2 KiB
# -*- coding: utf-8 -*-
|
|
# t08-fields.py — A4-3-3-1 新增客户表单字段标签提取
|
|
import io, sys, re
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
|
|
fn = '.scratch/opportunity-bugfix/lanhu-pages/A4-3-3-1_新增客户信息.md'
|
|
lines = open(fn, 'r', encoding='utf-8').read().splitlines()
|
|
# 抓「字段名:」式标签与输入类控件的短文本行
|
|
pats = re.compile(r'(\*\s*[\u4e00-\u9fa5A-Za-z0-9/]{2,12}|[\u4e00-\u9fa5A-Za-z0-9/]{2,12}:)')
|
|
seen = []
|
|
for ln in lines:
|
|
m = re.match(r'\| u\d+ \| (矩形|单元格|按钮|文本框|下拉框|单选按钮|复选框) \| Unnamed \| `?(.+?)`? \|$', ln.strip())
|
|
if not m:
|
|
continue
|
|
txt = m.group(2).strip()
|
|
if not txt or len(txt) > 25 or txt.startswith('itc') or txt in ('Unnamed',):
|
|
continue
|
|
if any(k in txt for k in ('管理','首页','菜单','工作台','收起','商机','线索','看板','系统设置','进入后台','项目','公海','我的','联系人20','联系人10','联系人8')):
|
|
continue
|
|
seen.append((m.group(1), txt))
|
|
# 去重保序
|
|
out, done = [], set()
|
|
for t, s in seen:
|
|
if s not in done:
|
|
done.add(s)
|
|
out.append((t, s))
|
|
for t, s in out:
|
|
print(f'{t}\t{s}')
|
|
print('TOTAL', len(out))
|
|
|