diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-08-24 09:31:39 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-08-24 09:31:39 -0700 |
commit | 93e3d463fdce74a2f5399a360e4da552ec2fa039 (patch) | |
tree | 43c0ec478542ae7a6a2f680db19abfdc6b25135e /src | |
parent | 49e810b4ed3642cf549622046bd7f2b98c700894 (diff) | |
download | pandoc-93e3d463fdce74a2f5399a360e4da552ec2fa039.tar.gz |
Docx writer: separate adjacent tables.
Word combines adjacent tables, so to prevent this we insert
an empty paragraph between two adjacent tables.
Closes #4315.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 10 |
1 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 |