1
0
mirror of https://codeberg.org/fediverse/fep.git synced 2026-08-06 04:05:53 +00:00
Files
fep/scripts/fep_tools/site_overview_page.py
T

42 lines
948 B
Python
Raw Normal View History

2025-11-01 08:40:20 +01:00
from . import index, table_for_feps
markdown_frontmatter = """---
hide:
- toc
- navigation
---
"""
def columns_for_status(status: str) -> list[str]:
columns = [
"title",
"repo_link_image",
"fep_type",
"implementation_count",
2025-11-01 08:40:20 +01:00
"tracking_issue",
"discussions",
"date_received",
]
if status == "FINAL":
columns.append("date_finalized")
elif status == "WITHDRAWN":
columns.append("date_withdrawn")
return columns
def write_overview_file(filename: str, status: str) -> None:
columns = columns_for_status(status)
feps = [x for x in index() if x.status == status]
table = "".join(
table_for_feps(feps, columns=columns, generate_title=True, format="static")
)
title = status[0] + status[1:].lower()
with open(filename, "w") as f:
f.write(markdown_frontmatter)
f.write(f"\n# {title}\n")
f.write(table)