fix: align nested Word blocks and synchronize CSS and heading navigation

This commit is contained in:
2026-11-05 12:11:42 +08:00
parent b3a0907e1a
commit 36f0d7856e
15 changed files with 383 additions and 96 deletions
+6 -2
View File
@@ -106,7 +106,10 @@ def test_word_preserves_all_settings_and_content(tmp_path: Path, engine):
assert spacing.get(W + "before") == spacing.get(W + "after") == "0"
assert spacing.get(W + "line") == "400" and spacing.get(W + "lineRule") == "exact"
ind = ppr.find(W + "ind")
assert ind.get(W + "firstLineChars") == "200" and ind.get(W + "right") == "120"
# List geometry uses absolute lengths so Word's document grid cannot
# shift code/heading continuations away from their list's text column.
assert ind.get(W + "firstLineChars") == ("0" if ppr.find(W + 'numPr') is not None else "200")
assert ind.get(W + "firstLine") == "420" and ind.get(W + "right") == "120"
assert ind.get(W + "left") == "850"
for name, value in (("keepNext", "1"), ("keepLines", "1"), ("contextualSpacing", "1"), ("pageBreakBefore", "0"), ("widowControl", "0")):
assert ppr.find(W + name).get(W + "val") == value
@@ -181,4 +184,5 @@ def test_pandoc_style_processing_preserves_math_links_and_numbering(tmp_path):
levels = xml.findall(".//w:pPr[w:numPr]", NS)
nested = [p for p in levels if p.find("w:numPr/w:ilvl", NS).get(W + "val") == "1"]
assert nested and int(nested[0].find(W + "ind").get(W + "left")) > 720
assert nested[0].find(W + "ind").get(W + "leftChars") == "500"
assert nested[0].find(W + "ind").get(W + "leftChars") == "0"
assert nested[0].find(W + "ind").get(W + "left") == "1200"