fix: 破损 HTML 表格扫描失败关闭

This commit is contained in:
2026-08-28 18:06:31 +08:00
parent 61b7ea7534
commit 10c026c7ad
8 changed files with 52 additions and 7 deletions
+16
View File
@@ -23,6 +23,7 @@ def test_expands_rows_without_changing_tags_attributes_or_cells() -> None:
"</table>\nafter"
)
assert len(result.changes) == 1
assert result.modifiers[0].version == "1.0.1"
@pytest.mark.parametrize("line_ending", ["\n", "\r\n", "\r"])
@@ -56,6 +57,21 @@ def test_mixed_multiline_or_non_strict_tables_are_preserved(markdown: str) -> No
assert transform(markdown).output_markdown == markdown
@pytest.mark.parametrize(
"markdown",
[
"<table>broken<table><tr><td>A</td></tr></table>",
"<table broken <table><tr><td>A</td></tr></table>",
],
)
def test_damaged_outer_table_does_not_expose_complete_inner_table(markdown: str) -> None:
result = transform(markdown)
assert result.status is RunStatus.SUCCESS
assert result.output_markdown == markdown
assert result.changes == ()
def test_successful_output_is_idempotent() -> None:
pipeline = Pipeline([html_table_layout()])
first = pipeline.transform(TABLE)