Docx writer: separate adjacent tables.

Word combines adjacent tables, so to prevent this we insert
an empty paragraph between two adjacent tables.

Closes #4315.
This commit is contained in:
John MacFarlane 2020-08-24 09:31:39 -07:00
parent 49e810b4ed
commit 93e3d463fd
2 changed files with 9 additions and 1 deletions

View file

@ -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

Binary file not shown.