@@ -14,19 +14,20 @@ def parse_makefiles(makefiles: list[str]):
1414 for path in makefiles :
1515 content = Path (path ).read_text ()
1616 fcategory = "General"
17- if (cdoc := re .search (r"### *@([\w-]+) *(.*?) *\\(\d+)\n" , content )):
18- fcategory = cdoc .group (1 )
19- cdocs [fcategory ] = (cdoc .group (2 ), int (cdoc .group (3 ) or 0 ))
20-
21- rawdocs = re .findall (r"((?:##.+\n)+)(.+):" , content , flags = re .MULTILINE )
22- for doc , rule in rawdocs :
23- doc = doc .replace ("##" , "" )
24- if (category := re .search (r"@([\w-]+)" , doc )):
25- doc = doc .replace (category .group (0 ), "" )
26- category = category .group (1 )
27- else :
28- category = fcategory
29- docs [category ][rule ] = [l .strip () for l in doc .splitlines ()]
17+ for groupcontent in re .split (r"### *@" , content ):
18+ if (cdoc := re .search (r"^([\w-]+) *(.*?) *\\(\d+)\n" , groupcontent )):
19+ fcategory = cdoc .group (1 )
20+ cdocs [fcategory ] = (cdoc .group (2 ), int (cdoc .group (3 ) or 0 ))
21+
22+ rawdocs = re .findall (r"((?:##.+\n)+)(.+):" , groupcontent , flags = re .MULTILINE )
23+ for doc , rule in rawdocs :
24+ doc = doc .replace ("##" , "" )
25+ if (category := re .search (r"@([\w-]+)" , doc )):
26+ doc = doc .replace (category .group (0 ), "" )
27+ category = category .group (1 )
28+ else :
29+ category = fcategory
30+ docs [category ][rule ] = [l .strip () for l in doc .splitlines ()]
3031
3132 return dict (docs ), cdocs
3233
0 commit comments