File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ({
You can’t perform that action at this time.
0 commit comments