Format a single document entry as a Markdown list item with link.
(entry: dict, data_root: Path, docs_page: Path)
| 213 | |
| 214 | |
| 215 | def format_entry_line(entry: dict, data_root: Path, docs_page: Path) -> str: |
| 216 | """Format a single document entry as a Markdown list item with link.""" |
| 217 | title = entry["title_zh"] |
| 218 | slug = entry["slug"] |
| 219 | doc_num = entry["doc_number"] |
| 220 | date = entry["effective_date"][:7] if entry["entry"].get("effective_date", "") else entry["effective_date"] |
| 221 | |
| 222 | # Relative path from docs page to data file |
| 223 | data_file = entry["file"] |
| 224 | try: |
| 225 | rel = data_file.relative_to(data_root) |
| 226 | # VitePress link: relative from docs page |
| 227 | docs_dir = docs_page.parent |
| 228 | # Calculate relative path |
| 229 | link = "/" + str(rel).replace("\\", "/").replace(".zh.md", "") |
| 230 | except ValueError: |
| 231 | link = "#" |
| 232 | |
| 233 | parts = [f"[{title}]({link})"] |
| 234 | if doc_num: |
| 235 | parts.append(f"`{doc_num}`") |
| 236 | if date: |
| 237 | parts.append(date[:7] if len(date) > 7 else date) |
| 238 | |
| 239 | return "| " + " | ".join(parts) + " |" |
| 240 | |
| 241 | |
| 242 | def generate_section_page( |