diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 10 | ||||
-rw-r--r-- | test/docx/golden/tables.docx | bin | 10273 -> 10276 bytes |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index f448c4ce2..e738008ee 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -848,7 +848,15 @@ writeOpenXML opts (Pandoc meta blocks) = do -- | Convert a list of Pandoc blocks to OpenXML. blocksToOpenXML :: (PandocMonad m) => WriterOptions -> [Block] -> WS m [Element] -blocksToOpenXML opts bls = concat `fmap` mapM (blockToOpenXML opts) bls +blocksToOpenXML opts = fmap concat . mapM (blockToOpenXML opts) . separateTables + +-- Word combines adjacent tables unless you put an empty paragraph between +-- them. See #4315. +separateTables :: [Block] -> [Block] +separateTables [] = [] +separateTables (x@Table{}:y@Table{}:zs) = + x : RawBlock (Format "openxml") "<w:p />" : separateTables (y:zs) +separateTables (x:xs) = x : separateTables xs pStyleM :: (PandocMonad m) => ParaStyleName -> WS m XML.Element pStyleM styleName = do diff --git a/test/docx/golden/tables.docx b/test/docx/golden/tables.docx Binary files differindex 38b4d2391..af30e1fe6 100644 --- a/test/docx/golden/tables.docx +++ b/test/docx/golden/tables.docx |