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:
parent
49e810b4ed
commit
93e3d463fd
2 changed files with 9 additions and 1 deletions
|
@ -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.
Loading…
Add table
Reference in a new issue