Normalize separator row.
(line: str, expected_cols: int = 0)
| 52 | |
| 53 | |
| 54 | def normalize_separator(line: str, expected_cols: int = 0) -> str: |
| 55 | """Normalize separator row.""" |
| 56 | stripped = line.strip().rstrip(" ") |
| 57 | if stripped.startswith("|"): |
| 58 | stripped = stripped[1:] |
| 59 | if stripped.endswith("|"): |
| 60 | stripped = stripped[:-1] |
| 61 | parts = [p.strip() for p in stripped.split("|")] |
| 62 | if expected_cols > 0: |
| 63 | while len(parts) < expected_cols: |
| 64 | parts.append("---") |
| 65 | parts = parts[:expected_cols] |
| 66 | return "| " + " | ".join(parts) + " |" |
| 67 | |
| 68 | |
| 69 | def fix_tables_in_content(content: str) -> str: |
no outgoing calls
no test coverage detected