aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-04-29 13:54:35 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-04-29 13:54:52 -0700
commita9f037a61591391066b7a51f7e1d263a1db66235 (patch)
tree1ee9c0a0b3de655a836683689d3f794efe6a222e
parent0db7d87240d64e526348a78f550a434c495a6e64 (diff)
downloadpandoc-a9f037a61591391066b7a51f7e1d263a1db66235.tar.gz
HTML reader: Support `<col>` and `<caption>` in tables.
Closes #486.
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index ee61bbac6..536bddd39 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -228,6 +228,8 @@ pSimpleTable :: TagParser [Block]
pSimpleTable = try $ do
TagOpen _ _ <- pSatisfy (~== TagOpen "table" [])
skipMany pBlank
+ caption <- option [] $ pInTags "caption" inline >>~ skipMany pBlank
+ skipMany $ pInTags "col" block >> skipMany pBlank
head' <- option [] $ pOptInTag "thead" $ pInTags "tr" (pCell "th")
skipMany pBlank
rows <- pOptInTag "tbody"
@@ -237,7 +239,7 @@ pSimpleTable = try $ do
let cols = maximum $ map length rows
let aligns = replicate cols AlignLeft
let widths = replicate cols 0
- return [Table [] aligns widths head' rows]
+ return [Table caption aligns widths head' rows]
pCell :: String -> TagParser [TableCell]
pCell celltype = try $ do