Skip to content

Commit 69534e1

Browse files
authored
Merge pull request #42 from Code4GovTech/api_markdown_fix
week filter to find all tags
2 parents c54405c + fcaa6fb commit 69534e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

v2_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ def week_data_formatter(html_content, type):
115115

116116
try:
117117
# Use regex to find week titles (e.g., Week 1, Week 2) and their corresponding task lists
118-
week_matches = re.findall(r'(Week \d+)', html_content)
119-
tasks_per_week = re.split(r'Week \d+', html_content)[1:] # Split the content by weeks and skip the first empty split
118+
week_matches = re.findall(r'Week\s*-?\s*\d+', html_content)
119+
tasks_per_week = re.split(r'Week\s*-?\s*\d+', html_content)[1:] # Split the content by weeks and skip the first empty split
120120

121121
weekly_updates = []
122122

123123
if type == "Learnings":
124124
# tasks_per_week = re.split(r'<h3>Week \d+</h3>', html_content)[1:]
125-
tasks_per_week = re.split(r'(<.*?>Week \d+<.*?>)', html_content)[1:]
126-
tasks_per_week = [tasks_per_week[i] for i in range(1, len(tasks_per_week), 2)]
125+
tasks_per_week = re.split(r'Week\s*-?\s*\d+', html_content)[1:]
126+
tasks_per_week = [tasks_per_week[i] for i in range(0, len(tasks_per_week))]
127127
for i, week in enumerate(week_matches):
128128
task_list_html = tasks_per_week[i] if i < len(tasks_per_week) else ""
129129
weekly_updates.append({

0 commit comments

Comments
 (0)