[FIX] длинные токены в таблицах переносятся, а не налезают на соседнюю колонку

This commit is contained in:
Arseny
2026-09-02 12:53:35 +03:00
parent 6b1f508825
commit f426e865b5
3 changed files with 59 additions and 1 deletions
+30
View File
@@ -410,3 +410,33 @@ def test_table_without_left_columns_stays_plain_tabular() -> None:
tex = body(render("| a | b |\n| :---: | :---: |\n| 1 | 2 |\n"))
assert "\\begin{tabular}{|c|c|}" in tex
assert "\\begin{tabularx}" not in tex
LONG_TOKEN_TABLE_MD = (
"| Направление | Формат | Назначение |\n"
"| :--- | :--- | :--- |\n"
"| сервер | HackRFTestingServer:идентификатор | Приветствие, подтверждает |\n"
)
def test_long_token_in_cell_gets_break_points() -> None:
"""Иначе токен не переносится и печатается поверх соседней колонки."""
tex = body(render(LONG_TOKEN_TABLE_MD))
assert "HackRFTestingServer:\\allowbreak" in tex
def test_short_cells_are_left_alone() -> None:
tex = body(render("| a | b |\n| :--- | :--- |\n| ping | сервер |\n"))
assert "\\allowbreak" not in tex
def test_break_points_do_not_touch_latex_commands() -> None:
"""В ячейке с разметкой есть команды; ломать их вставками нельзя."""
tex = body(
render(
"| Поле | Значение |\n| :--- | :--- |\n"
"| **оченьдлинноежирноеслово_подчёркивание** | x |\n"
)
)
assert "\\textbf{" in tex
assert "\\textbf\\allowbreak" not in tex