| 18 | ASSET_DIR = REPO_ROOT / "assets" / "images" / "mdcg" |
| 19 | |
| 20 | def get_source_url(doc_id): |
| 21 | zh_file = ZH_DIR / f"{doc_id}.md" |
| 22 | if not zh_file.exists(): |
| 23 | zh_file = REPO_ROOT / "eu_mdr" / "mdcg" / f"{doc_id}.zh.md" |
| 24 | if not zh_file.exists(): |
| 25 | return None |
| 26 | content = zh_file.read_text(encoding="utf-8") |
| 27 | for line in content.split("\n"): |
| 28 | if line.startswith("source_url:"): |
| 29 | url = line.split("source_url:", 1)[1].strip() |
| 30 | return url |
| 31 | return None |
| 32 | |
| 33 | def process_doc(doc_id): |
| 34 | url = get_source_url(doc_id) |