docs: 记录超字数的存量豁免与「下不为例」约定
- MEMORY.md 排版约定下补:01-知识点盘点.md(17335) 与 09-点8-曲线积分.md(17689) 获一次性豁免、不拆,但再涨即违规;新文件一律不得超 1.3 万 - vector-audit 校验器加 SIZE_EXEMPT:豁免文件走 EXEMPT 而非 WARN, 同时记下豁免时字数,超过该值仍旧报 WARN - README 的「一条待处理」改写为「一条已豁免」,写明理由与收紧规则
This commit is contained in:
@@ -13,6 +13,11 @@ ROOT = Path(__file__).resolve().parents[3]
|
||||
CHAPTER = ROOT / '基于考研的学习/数学一/在学练习/线性代数-第3讲-向量'
|
||||
checks = []
|
||||
warns = []
|
||||
exempt = []
|
||||
|
||||
# 已获豁免的超限文件(2026-11-04 用户批准,仅此一次)。只放这一条,
|
||||
# 新增的豁免必须单独获得同意;数值写着「不得再涨」,涨了仍会照实打印。
|
||||
SIZE_EXEMPT = {'01-知识点盘点.md': 17335}
|
||||
|
||||
def check(name, value):
|
||||
assert value, name
|
||||
@@ -170,8 +175,17 @@ for file in sorted(CHAPTER.glob('*.md')):
|
||||
check('structure summaries '+file.name, text.count('<summary>') == text.count('</summary>') == text.count('<details>'))
|
||||
# 字符数上限是项目约定(单文件 ≤ 1.3 万字符)。超限只记警告:它不影响
|
||||
# 数值与链接的正确性,若直接 assert 会让后面几百项检查全部不执行。
|
||||
# 2026-11-04 用户明确豁免本讲 01-知识点盘点.md 一次(拆分会打断 15 个考点的
|
||||
# 编号体系),但**只豁免这一个文件、只此一次**:新文件一律不得超。
|
||||
if len(text) > 13000:
|
||||
warns.append('file size %s: %d 字符 > 13000' % (file.name, len(text)))
|
||||
msg = 'file size %s: %d 字符 > 13000' % (file.name, len(text))
|
||||
cap = SIZE_EXEMPT.get(file.name)
|
||||
if cap is None:
|
||||
warns.append(msg)
|
||||
elif len(text) > cap:
|
||||
warns.append(msg + '(豁免时 %d,现又上涨)' % cap)
|
||||
else:
|
||||
exempt.append(msg + '(豁免上限 %d)' % cap)
|
||||
check('structure no replacement chars '+file.name, '\ufffd' not in text)
|
||||
check('structure math dollar parity '+file.name, text.count('$') % 2 == 0)
|
||||
for target in re.findall(r'\]\(([^)]+)\)', text):
|
||||
@@ -180,9 +194,12 @@ for file in sorted(CHAPTER.glob('*.md')):
|
||||
|
||||
report = {'passed': len(checks), 'arithmetic': 'fractions.Fraction',
|
||||
'scope': 'Numerical examples, parameter branches, link and Markdown structure; abstract proofs manually reviewed',
|
||||
'exempt': exempt,
|
||||
'warnings': warns,
|
||||
'checks': checks}
|
||||
(Path(__file__).resolve().parent / 'vector_learning_checks.json').write_text(json.dumps(report, ensure_ascii=False, indent=2)+'\n', encoding='utf-8')
|
||||
print(f'PASS: {len(checks)} exact numerical and structural checks')
|
||||
for w in exempt:
|
||||
print('EXEMPT:', w)
|
||||
for w in warns:
|
||||
print('WARN:', w)
|
||||
|
||||
Reference in New Issue
Block a user