Load source URLs from .zh.md front matter.
()
| 44 | |
| 45 | |
| 46 | def load_source_urls(): |
| 47 | """Load source URLs from .zh.md front matter.""" |
| 48 | urls = {} |
| 49 | mdcg_dir = REPO_ROOT / "eu_mdr" / "mdcg" |
| 50 | for f in mdcg_dir.glob("*.zh.md"): |
| 51 | doc_id = f.stem.replace(".zh", "") |
| 52 | content = f.read_text(encoding="utf-8") |
| 53 | for line in content.split("\n"): |
| 54 | if line.startswith("source_url:"): |
| 55 | url = line.split("source_url:", 1)[1].strip() |
| 56 | if url and url.startswith("http"): |
| 57 | urls[doc_id] = url |
| 58 | break |
| 59 | return urls |
| 60 | |
| 61 | |
| 62 | def convert_one(doc_id: str, source_url: str, converter: DocumentConverter): |