git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: fix regression on captions.

The "Table Caption" style was no longer getting applied. (It was overwritten by "Compact.") Closes #7328.

commitc2f46e6df4a80a313ab4329b740770dbdfbe1578 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 30 May 2021, 10:07 (5 years ago) parentf363f00
1 file changed+3−1
src/Text/Pandoc/Writers/Docx/Table.hs+3−1
src/Text/Pandoc/Writers/Docx/Table.hs+3−1
@@ -33,7 +33,6 @@ tableToOpenXML :: PandocMonad m
3333 -> WS m [Content]
3434tableToOpenXML blocksToOpenXML gridTable = do
3535 setFirstPara
36− modify $ \s -> s { stInTable = True }
3736 let (Grid.Table _attr caption colspecs _rowheads thead tbodies tfoot) =
3837 gridTable
3938 let (Caption _maybeShortCaption captionBlocks) = caption
@@ -43,6 +42,9 @@ tableToOpenXML blocksToOpenXML gridTable = do
4342 then return []
4443 else withParaPropM (pStyleM "Table Caption")
4544 $ blocksToOpenXML captionBlocks
45+ -- We set "in table" after processing the caption, because we don't
46+ -- want the "Table Caption" style to be overwritten with "Compact".
47+ modify $ \s -> s { stInTable = True }
4648 head' <- cellGridToOpenXML blocksToOpenXML HeadRow aligns thead
4749 bodies <- mapM (cellGridToOpenXML blocksToOpenXML BodyRow aligns) tbodies
4850 foot' <- cellGridToOpenXML blocksToOpenXML FootRow aligns tfoot