INNER CODE UNIT · Python
patches_table
MorpheApp/morphe-patches · .github/scripts/generate_patches_readme.py:77
def patches_table(patches):
"""Render a sorted markdown table of patches with name, description, and options."""
rows = [
"| 💊 Patch | 📜 Description | ⚙️ Options |",
"|----------|----------------|-----------|",
]
for p in sorted(patches, key=lambda x: x["name"]):
a = anchor(p["name"])
options = p.get("options") or []
if options:
# Show only option titles as a bullet list
parts = [opt.get("title") or opt.get("key") or "" for opt in options]
opts_cell = "<br>".join(f"• {t}" for t in parts)
else:
opts_cell = ""
desc = (p.get("description") or "").replace("\n", "<br>")
rows.append(f"| [{p['name']}](#{a}) | {desc} | {opts_cell} |")
return "\n".join(rows)