Files
gplan-2/fix_refs2.py
T

16 lines
824 B
Python

# -*- coding: utf-8 -*-
import pathlib, re
for tf, pairs in [
('design/gdd/systems/冒险循环/难度曲线与Boss.md', [('numfix-newruler-readings-2026-10-01.md', '数值修复批读数(已退役,git 历史可查)')]),
('design/gdd/07-体验验证清单.md', [('numfix-newruler-readings-2026-10-01.md', '数值修复批读数(已退役,git 历史可查)')]),
('design/gdd/ux/level-map.md', [('m2-exit-gate-checklist-2026-09-28.md', 'M2 出口检查单(已退役,git 历史可查)')]),
]:
p = pathlib.Path(tf); d = p.read_bytes(); n = 0
for b, repl in pairs:
pat = re.compile(rb'[\w./\-\\]*' + re.escape(b.encode()))
hits = pat.findall(d)
assert hits, (tf, b)
d = pat.sub(repl.encode(), d); n += len(hits)
p.write_bytes(d); print('fixed', tf, n)
print('OK')