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.
30 lines
1.0 KiB
30 lines
1.0 KiB
# -*- coding: utf-8 -*-
|
|
# t07-extract2.py — 提取 A1X 批注区(标题行 ± 邻行全文)
|
|
import io, sys
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
|
|
base = '.scratch/opportunity-bugfix/lanhu-pages/'
|
|
files = [
|
|
'A1X-1_工作计划_工作日历.md',
|
|
'A1X-2_工作计划_计划管理.md',
|
|
'A1X-3_工作计划_出差与拜访.md',
|
|
'A1X-1-2_填写今日工作.md',
|
|
'A1X-1-3_工作计划详情.md',
|
|
]
|
|
for fn in files:
|
|
lines = open(base + fn, 'r', encoding='utf-8').read().splitlines()
|
|
print(f'\n===== {fn} ({len(lines)} 行) =====')
|
|
idx = [i for i, ln in enumerate(lines) if '、开发说明' in ln or '、页面说明' in ln]
|
|
seen = set()
|
|
for i in idx:
|
|
for j in range(i, min(i + 4, len(lines))):
|
|
if j in seen:
|
|
continue
|
|
seen.add(j)
|
|
ln = lines[j]
|
|
if len(ln) > 300: # 大单元格=批注内容行
|
|
print(ln[:5000])
|
|
break
|
|
if not idx:
|
|
print('(无批注标题行)')
|
|
print('\ndone')
|
|
|