git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Support `<col>` and `<caption>` in tables.

Closes #486.

commita9f037a61591391066b7a51f7e1d263a1db66235 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 29 Apr 2012, 13:54 (14 years ago) parent0db7d87
1 file changed+3−1
src/Text/Pandoc/Readers/HTML.hs+3−1
src/Text/Pandoc/Readers/HTML.hs+3−1
@@ -228,6 +228,8 @@ pSimpleTable :: TagParser [Block]
228228pSimpleTable = try $ do
229229 TagOpen _ _ <- pSatisfy (~== TagOpen "table" [])
230230 skipMany pBlank
231+ caption <- option [] $ pInTags "caption" inline >>~ skipMany pBlank
232+ skipMany $ pInTags "col" block >> skipMany pBlank
231233 head' <- option [] $ pOptInTag "thead" $ pInTags "tr" (pCell "th")
232234 skipMany pBlank
233235 rows <- pOptInTag "tbody"
@@ -237,7 +239,7 @@ pSimpleTable = try $ do
237239 let cols = maximum $ map length rows
238240 let aligns = replicate cols AlignLeft
239241 let widths = replicate cols 0
240− return [Table [] aligns widths head' rows]
242+ return [Table caption aligns widths head' rows]
241243
242244pCell :: String -> TagParser [TableCell]
243245pCell celltype = try $ do