aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-11-14 14:35:58 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-11-14 15:10:38 +0300
commit195b3af8b63bed91d565d8745e75f07509bb595d (patch)
tree648f39273ef0ea7876554050b56ec770b9e407fe /src/Text
parentd27384c10962c30c2a9d5cf7bd93fb7e48ff57a4 (diff)
downloadpandoc-195b3af8b63bed91d565d8745e75f07509bb595d.tar.gz
Muse writer: indent simple tables only on the top level
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index b74016ec2..005909ac1 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -171,19 +171,20 @@ simpleTable :: PandocMonad m
-> [[TableCell]]
-> Muse m Doc
simpleTable caption headers rows = do
+ topLevel <- asks envTopLevel
caption' <- inlineListToMuse caption
headers' <- mapM blockListToMuse headers
rows' <- mapM (mapM blockListToMuse) rows
let widthsInChars = maximum . map offset <$> transpose (headers' : rows')
let hpipeBlocks sep blocks = hcat $ intersperse sep' blocks
where sep' = lblock (length sep) $ text sep
- let makeRow sep = (" " <>) . hpipeBlocks sep . zipWith lblock widthsInChars
+ let makeRow sep = hpipeBlocks sep . zipWith lblock widthsInChars
let head' = makeRow " || " headers'
rows'' <- mapM (\row -> makeRow rowSeparator <$> mapM blockListToMuse row) rows
let body = vcat rows''
- return $ (if noHeaders then empty else head')
- $$ body
- $$ (if null caption then empty else " |+ " <> caption' <> " +|")
+ return $ (if topLevel then nest 1 else id) ((if noHeaders then empty else head')
+ $$ body
+ $$ (if null caption then empty else "|+ " <> caption' <> " +|"))
$$ blankline
where noHeaders = all null headers
rowSeparator = if noHeaders then " | " else " | "