aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorZihang Chen <chsc4698@gmail.com>2019-08-13 16:37:41 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-08-13 16:37:41 -0700
commitd4fa38a0a5b3d1796d959a5480e591539abad7a8 (patch)
tree1a9115914c0ba518ed9ce619b567956816ff33f8 /src/Text/Pandoc/Writers
parenta0a41c7a8e4e385450c55459b9a01a59755766d2 (diff)
downloadpandoc-d4fa38a0a5b3d1796d959a5480e591539abad7a8.tar.gz
Fix multiline table for XWiki writer (#5683)
Details at https://groups.google.com/forum/#!topic/pandoc-discuss/c861tTdCFTg Fix XWiki output for ``` +----------+----------+ | Col A | Col B | +==========+==========+ | Row A | * Item A | | | * Item B | +----------+----------+ ``` from (notice that the following XWiki code renders as a table followed by a singleton list) ``` |=Col A|=Col B |Row A|*. Item A *. Item B ``` to ``` |=Col A|=Col B |Row A|(((*. Item A *. Item B ))) ```
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/XWiki.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/XWiki.hs b/src/Text/Pandoc/Writers/XWiki.hs
index ce0f83b61..e6cd0b086 100644
--- a/src/Text/Pandoc/Writers/XWiki.hs
+++ b/src/Text/Pandoc/Writers/XWiki.hs
@@ -139,9 +139,11 @@ formRow row = do
tableCellXWiki :: PandocMonad m => Bool -> [Block] -> XWikiReader m Text
tableCellXWiki isHeader cell = do
contents <- blockListToXWiki cell
+ let isMultiline = (length . split (== '\n')) contents > 1
+ let contents' = intercalate contents $ if isMultiline then [pack "(((", pack ")))"] else [mempty, mempty]
let cellBorder = if isHeader then "|=" else "|"
- return $ cellBorder <> contents
-
+ return $ cellBorder <> contents'
+
inlineListToXWiki :: PandocMonad m => [Inline] -> XWikiReader m Text
inlineListToXWiki lst =