MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / format_entry_line

Function format_entry_line

scripts/generate_docs_index.py:215–239  ·  view source on GitHub ↗

Format a single document entry as a Markdown list item with link.

(entry: dict, data_root: Path, docs_page: Path)

Source from the content-addressed store, hash-verified

213
214
215def 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
242def generate_section_page(

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected