fix: replace all dates when creating new issue

This commit is contained in:
recanman 2025-03-20 22:15:31 -07:00
parent a1e29457dc
commit 7af6f05f39

View File

@ -71,10 +71,18 @@ def create_issue(
lines = content.split("\n")
period_string = get_period_string(period_start, period_end, True)
meeting_placeholder = f"{period_start.strftime("%B")} [day], {period_start.year}"
data_placeholder = period_end.strftime("%B %-d, %Y")
for i, line in enumerate(lines):
if line.startswith("title:"):
lines[i] = f'title: "Issue {issue_number}: {period_string}"'
elif line.startswith("{{% event"): # replace date in event shortcode
lines[i] = line.replace("July 1, 2024", meeting_placeholder)
elif 'date="January 1, 2024"' in line: #replace date in bc_stats shortcode
lines[i] = line.replace("January 1, 2024", data_placeholder)
elif 'date="June 6, 2024"' in line: #replace date in price_performance shortcode
lines[i] = line.replace("June 6, 2024", data_placeholder)
content = "\n".join(lines)