mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
Docx writer: fix FirstParagraph style lost after heading with footnote.
When a heading contained a footnote, processing the footnote's block content would consume the stFirstPara flag, causing the following paragraph to incorrectly receive BodyText style instead of FirstParagraph. Fix by saving and restoring stFirstPara around footnote block processing. Closes #11573. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -353,4 +353,25 @@ tests = [ testGroup "inlines"
|
||||
assertBool "Language from metadata did not override reference docx (expected fr-FR)"
|
||||
(any ("fr-FR" `isInfixOf`) (getLangLines stylesXml))
|
||||
]
|
||||
, testGroup "paragraph styles"
|
||||
[ testCase "FirstParagraph after heading with footnote (#11573)" $ do
|
||||
let opts = def
|
||||
bs <- runIOorExplode $ do
|
||||
setVerbosity ERROR
|
||||
let doc = Pandoc mempty
|
||||
[ Header 3 ("heading-with-note", [], [])
|
||||
[Note [Para [Str "note"]], Str "Heading"]
|
||||
, Para [Str "Para", Space, Str "after."]
|
||||
]
|
||||
writeDocx opts doc
|
||||
let archive = toArchive bs
|
||||
entry <- case findEntryByPath "word/document.xml" archive of
|
||||
Nothing -> assertFailure "Missing word/document.xml in output docx"
|
||||
Just e -> return e
|
||||
let docXml = show (fromEntry entry)
|
||||
assertBool
|
||||
("Expected FirstParagraph style after heading with footnote, got: "
|
||||
++ docXml)
|
||||
("FirstParagraph" `isInfixOf` docXml)
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user