aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-08-13 10:43:43 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-08-13 10:43:43 -0700
commit8f65590ce9fc84452b22a3914190a8d9bc4ceda2 (patch)
tree32830240754311eb8700ce58f0720f718294c7ef
parent506866ef7368ed1cae9236bfd8323fde64eeb154 (diff)
downloadpandoc-8f65590ce9fc84452b22a3914190a8d9bc4ceda2.tar.gz
CommonMark writer: prefer pipe tables to HTML tables...
...even if it means losing relative column width information. See #3734.
-rw-r--r--src/Text/Pandoc/Writers/CommonMark.hs5
-rw-r--r--test/command/3734.md11
2 files changed, 13 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/CommonMark.hs b/src/Text/Pandoc/Writers/CommonMark.hs
index 77562ed8a..446578f42 100644
--- a/src/Text/Pandoc/Writers/CommonMark.hs
+++ b/src/Text/Pandoc/Writers/CommonMark.hs
@@ -148,7 +148,7 @@ blockToNodes opts (DefinitionList items) ns =
Plain (term ++ [LineBreak] ++ xs) : ys ++ concat zs
dlToBullet (term, xs) =
Para term : concat xs
-blockToNodes opts t@(Table capt aligns widths headers rows) ns = do
+blockToNodes opts t@(Table capt aligns _widths headers rows) ns = do
let allcells = concat (headers:rows)
let isLineBreak LineBreak = Any True
isLineBreak _ = Any False
@@ -156,8 +156,7 @@ blockToNodes opts t@(Table capt aligns widths headers rows) ns = do
isPlainOrPara [Plain _] = True
isPlainOrPara [] = True
isPlainOrPara _ = False
- let isSimple = all (==0) widths &&
- all isPlainOrPara allcells &&
+ let isSimple = all isPlainOrPara allcells &&
not ( getAny (query isLineBreak allcells) )
if isEnabled Ext_pipe_tables opts && isSimple
then do
diff --git a/test/command/3734.md b/test/command/3734.md
index 1adce6761..d7e6f20b1 100644
--- a/test/command/3734.md
+++ b/test/command/3734.md
@@ -37,3 +37,14 @@
|--------------|-------|--------------------------------------------------------------------------|
| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
```
+
+```
+% pandoc -t gfm
+| aaaaaaaaaaaa | bbbbb | ccccccccccc |
+|--------------|-------|--------------------------------------------------------------------------|
+| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
+^D
+| aaaaaaaaaaaa | bbbbb | ccccccccccc |
+| ------------ | ----- | ------------------------------------------------------------------------ |
+| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
+```