File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -115,15 +115,15 @@ def week_data_formatter(html_content, type):
115
115
116
116
try :
117
117
# 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
120
120
121
121
weekly_updates = []
122
122
123
123
if type == "Learnings" :
124
124
# 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 ))]
127
127
for i , week in enumerate (week_matches ):
128
128
task_list_html = tasks_per_week [i ] if i < len (tasks_per_week ) else ""
129
129
weekly_updates .append ({
You can’t perform that action at this time.
0 commit comments