修正: deepseek 笔记 96 处块级公式改为多行写法(适配 SilverBullet 行首锚点), 索引脚本同步 _abstract 命名
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Sync plan.json md_path with the actual note filenames on disk.
|
||||
|
||||
The notes were renamed with an `_abstract` suffix to avoid page-name clashes
|
||||
with the same-named PDFs in SilverBullet. This rewrites plan.json accordingly.
|
||||
|
||||
Usage: python sync_plan_paths.py <plan.json> <base_dir>
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
plan_path, base = sys.argv[1], sys.argv[2]
|
||||
plan = json.load(open(plan_path, encoding='utf-8'))
|
||||
changed = 0
|
||||
missing = []
|
||||
for p in plan:
|
||||
d = p['dir']
|
||||
stem = p['stem']
|
||||
candidates = [
|
||||
os.path.join(d, stem + '.md'),
|
||||
os.path.join(d, stem + '_abstract.md'),
|
||||
]
|
||||
found = None
|
||||
for c in candidates:
|
||||
if os.path.exists(os.path.join(base, c)):
|
||||
found = c
|
||||
break
|
||||
if not found:
|
||||
missing.append((p['id'], stem))
|
||||
continue
|
||||
if p['md_path'] != found:
|
||||
p['md_path'] = found
|
||||
changed += 1
|
||||
|
||||
json.dump(plan, open(plan_path, 'w', encoding='utf-8'), ensure_ascii=False, indent=1)
|
||||
print('md_path 已更新:', changed, '/', len(plan))
|
||||
if missing:
|
||||
print('未找到对应 md 的论文:')
|
||||
for m in missing:
|
||||
print(' !', m)
|
||||
Reference in New Issue
Block a user