aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index f6657a4d1..56d35160c 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -88,7 +88,7 @@ block = choice
, pCodeBlock
, pList
, pHrule
- , pSimpleTable
+ , pTable
, pHead
, pBody
, pPlain
@@ -212,8 +212,8 @@ pHrule = do
pSelfClosing (=="hr") (const True)
return [HorizontalRule]
-pSimpleTable :: TagParser [Block]
-pSimpleTable = try $ do
+pTable :: TagParser [Block]
+pTable = try $ do
TagOpen _ _ <- pSatisfy (~== TagOpen "table" [])
skipMany pBlank
caption <- option [] $ pInTags "caption" inline >>~ skipMany pBlank
@@ -225,6 +225,11 @@ pSimpleTable = try $ do
$ many1 $ try $ skipMany pBlank >> pInTags "tr" (pCell "td")
skipMany pBlank
TagClose _ <- pSatisfy (~== TagClose "table")
+ let isSinglePlain [] = True
+ isSinglePlain [Plain _] = True
+ isSinglePlain _ = False
+ let isSimple = all isSinglePlain $ concat (head':rows)
+ guard isSimple
let cols = maximum $ map length rows
let aligns = replicate cols AlignLeft
let widths = replicate cols 0
@@ -233,7 +238,7 @@ pSimpleTable = try $ do
pCell :: String -> TagParser [TableCell]
pCell celltype = try $ do
skipMany pBlank
- res <- pInTags celltype pPlain
+ res <- pInTags celltype block
skipMany pBlank
return [res]