Skip to content

Commit

Permalink
Group build manifests by year
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbunnyru committed Dec 28, 2024
1 parent 2ba3651 commit 209a746
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tagging/update_wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,36 @@


def update_home_wiki_page(wiki_dir: Path, year_month: str) -> None:
TABLE_BEGINNING = """\
YEAR_MONTHLY_TABLES = "<!-- YEAR_MONTHLY_TABLES -->\n"

TABLE_HEADER = """\
| Month |
| ---------------------- |
"""

wiki_home_file = wiki_dir / "Home.md"
wiki_home_content = wiki_home_file.read_text()

year = year_month[:4]
year_header = f"## {year}\n"
if year_header not in wiki_home_content:
assert YEAR_MONTHLY_TABLES in wiki_home_content
wiki_home_content = wiki_home_content.replace(
YEAR_MONTHLY_TABLES,
YEAR_MONTHLY_TABLES + f"\n{year_header}\n{TABLE_HEADER}",
)
LOGGER.info(f"Updated wiki home page with year header for year: {year}")

year_month_line = f"| [`{year_month}`](./{year_month}) |\n"
if year_month_line not in wiki_home_content:
assert TABLE_BEGINNING in wiki_home_content
assert TABLE_HEADER in wiki_home_content
wiki_home_content = wiki_home_content.replace(
TABLE_BEGINNING, TABLE_BEGINNING + year_month_line
TABLE_HEADER, TABLE_HEADER + year_month_line
)
wiki_home_file.write_text(wiki_home_content)
LOGGER.info(f"Updated wiki home page with month: {year_month}")

wiki_home_file.write_text(wiki_home_content)


def update_monthly_wiki_page(
wiki_dir: Path, year_month: str, build_history_line: str
Expand Down

0 comments on commit 209a746

Please sign in to comment.