(text: str, section_heading: str, subsection_heading: str)
| 1240 | |
| 1241 | |
| 1242 | def subsection_body(text: str, section_heading: str, subsection_heading: str) -> str: |
| 1243 | body = section_body(text, section_heading) |
| 1244 | if not body: |
| 1245 | return "" |
| 1246 | pattern = rf"^###\s+{re.escape(subsection_heading)}\s*$" |
| 1247 | match = re.search(pattern, body, flags=re.MULTILINE) |
| 1248 | if not match: |
| 1249 | return "" |
| 1250 | start = match.end() |
| 1251 | next_match = re.search(r"^(?:##|###)\s+.+$", body[start:], flags=re.MULTILINE) |
| 1252 | if not next_match: |
| 1253 | return body[start:] |
| 1254 | return body[start : start + next_match.start()] |
| 1255 | |
| 1256 | |
| 1257 | def cleaned_section_lines(body: str) -> list[str]: |
no test coverage detected