@@ -30,10 +30,19 @@ def remove_coauthor_headings(self, text):
30
30
# Assumes Markdown formatting where 1st level is '# ' and 2nd level is '## '
31
31
standard_text = self .standardize_coauthor_heading (text )
32
32
pattern = r'^#{1,2}\s*Co-Authors.*$\n?'
33
- cleaned_text = re .sub (pattern , '' , standard_text , flags = re .MULTILINE )
33
+ cleaned_text = re .sub (pattern , '' , standard_text , flags = re .IGNORECASE | re . MULTILINE )
34
34
35
35
return cleaned_text
36
36
37
+
38
+ def add_coauthor_heading_before_co_authored_by_list (self , text ):
39
+ search_pattern = r'^(Co-Authored-By.*)$'
40
+ replace_pattern = r'## Co-Authors\n\1'
41
+ cleaned_text = re .sub (search_pattern , replace_pattern , text ,
42
+ count = 1 ,
43
+ flags = re .IGNORECASE | re .MULTILINE )
44
+ return cleaned_text
45
+
37
46
def applesauce (self , text ):
38
47
pattern = r'^#+\s*Co-Author$'
39
48
re .sub (pattern , text ,flags = re .IGNORECASE )
@@ -58,6 +67,8 @@ def cleanup_contents(self, text, session_date):
58
67
if self .contains_active_coauthors (text ) and self .contains_inactive_coauthors (text ):
59
68
text = self .delete_inactive_coauthors (text )
60
69
text = self .standardize_coauthor_heading (text )
70
+ text = self .remove_coauthor_headings (text )
71
+ text = self .add_coauthor_heading_before_co_authored_by_list (text )
61
72
return text
62
73
63
74
def cleanup_file (self , filename ):
0 commit comments