v0.6.0 BigUpdate
Example document / build (push) Has been cancelled
Python application / build (push) Has been cancelled

This commit is contained in:
Igor20264
2026-10-20 11:38:06 +03:00
parent daa84f8bce
commit 8223e0ac14
77 changed files with 12158 additions and 117 deletions
+21 -6
View File
@@ -454,7 +454,7 @@ _TABLE_BLOCK_RE = re.compile(
r"(?:^[ \t]*\|.+\|[ \t]*\n?)*",
re.M,
)
_MERGE_ONLY_RE = re.compile(r"^\s*(\^{1,2}|>{1,2})\s*$")
_MERGE_ONLY_RE = re.compile(r"^\s*(\^{1,2}|>{1,2}|<{1,2})\s*$")
def _split_table_row(line: str) -> list[str]:
@@ -467,7 +467,11 @@ def _split_table_row(line: str) -> list[str]:
def check_table_merge(text: str) -> list[Issue]:
"""Validate ^ / > merge markers in pipe tables."""
"""Validate ^ / > / < merge markers in pipe tables.
`<` continues the cell on the left, same as `>`, and may sit in the header
so a title can span the row. `^` and `>` stay forbidden in the header.
"""
issues: list[Issue] = []
for tm in _TABLE_BLOCK_RE.finditer(text):
block = tm.group(0)
@@ -481,8 +485,18 @@ def check_table_merge(text: str) -> list[Issue]:
n_cols = len(header)
header_line = _line_of(text, block_start)
for cell in header:
if _MERGE_ONLY_RE.match(cell):
for c_i, cell in enumerate(header):
m = _MERGE_ONLY_RE.match(cell)
if not m:
continue
if m.group(1)[:1] in (">", "<") and c_i == 0:
marker = m.group(1)[:1]
issues.append(Issue(
"table.merge_col", "error",
f"Маркер «{marker}» нельзя ставить в первом столбце (нет ячейки слева)",
header_line,
))
elif not m.group(1).startswith("<"):
issues.append(Issue(
"table.merge_header", "error",
"Маркер склеивания ^/> нельзя использовать в первой (заголовочной) строке таблицы",
@@ -497,10 +511,11 @@ def check_table_merge(text: str) -> list[Issue]:
m = _MERGE_ONLY_RE.match(cell)
if not m:
continue
if m.group(1).startswith(">") and c_i == 0:
if m.group(1)[:1] in (">", "<") and c_i == 0:
marker = m.group(1)[:1]
issues.append(Issue(
"table.merge_col", "error",
"Маркер «>» нельзя ставить в первом столбце (нет ячейки слева)",
f"Маркер «{marker}» нельзя ставить в первом столбце (нет ячейки слева)",
line_no,
))