Private
Public Access
0
0

more organization

This commit is contained in:
2026-06-06 10:24:22 -04:00
parent 1c627bcc30
commit 7d555361f9
20 changed files with 630 additions and 725 deletions
+5 -5
View File
@@ -30,8 +30,8 @@ class TableBlock:
[C: src/markdown_helper.py:MarkdownRenderer.render]
"""
headers: list[str]
rows: list[list[str]]
span: tuple[int, int]
rows: list[list[str]]
span: tuple[int, int]
def _split_row(line: str) -> list[str]:
line = line.strip()
@@ -45,7 +45,7 @@ def _is_table_at(lines: list[str], i: int) -> bool:
return bool(_TABLE_SEPARATOR.match(lines[i + 1]))
def parse_tables(text: str) -> list[TableBlock]:
lines = text.splitlines()
lines = text.splitlines()
in_fence = False
blocks: list[TableBlock] = []
i = 0
@@ -53,14 +53,14 @@ def parse_tables(text: str) -> list[TableBlock]:
line = lines[i]
if line.strip().startswith("```"):
in_fence = not in_fence
i += 1
i += 1
continue
if in_fence:
i += 1
continue
if _is_table_at(lines, i):
headers = _split_row(lines[i])
j = i + 2
j = i + 2
rows: list[list[str]] = []
while j < len(lines) and "|" in lines[j] and not _TABLE_SEPARATOR.match(lines[j]):
rows.append(_split_row(lines[j]))