diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2020-11-26 07:22:01 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2020-11-26 07:22:01 +0100 |
commit | 3e01ae405f9bf5f40e1b8e519029825aa4880602 (patch) | |
tree | 252046d7cd71e91b380cb0d3c3afcb6f7760e460 /src/Text/Pandoc/Readers/HTML/Table.hs | |
parent | ce606cb688a703b133ab7188fee45679e356a07d (diff) | |
download | pandoc-3e01ae405f9bf5f40e1b8e519029825aa4880602.tar.gz |
HTML reader: allow finer grained options for tag omission
Diffstat (limited to 'src/Text/Pandoc/Readers/HTML/Table.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML/Table.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/HTML/Table.hs b/src/Text/Pandoc/Readers/HTML/Table.hs index eba84884f..e6d0a9097 100644 --- a/src/Text/Pandoc/Readers/HTML/Table.hs +++ b/src/Text/Pandoc/Readers/HTML/Table.hs @@ -69,15 +69,16 @@ pTable' block pCell = try $ do caption <- option mempty $ pInTags "caption" block <* skipMany pBlank widths' <- (mconcat <$> many1 pColgroup) <|> many pCol let pTh = option [] $ pInTags "tr" (pCell "th") - pTr = try $ skipMany pBlank >> - pInTags "tr" (pCell "td" <|> pCell "th") - pTBody = pInTag True "tbody" $ many1 pTr - head'' <- pInTag False "thead" (option [] pTr) <|> pInTag True "thead" pTh - head' <- pInTag True "tbody" + pTr = try $ skipMany pBlank + *> pInTags "tr" (pCell "td" <|> pCell "th") + pTBody = pInTag TagsOmittable "tbody" $ many1 pTr + head'' <- pInTag ClosingTagOptional "thead" (option [] pTr) + <|> pInTag TagsOmittable "thead" pTh + head' <- pInTag TagsOmittable "tbody" (if null head'' then pTh else return head'') - topfoot <- option [] $ pInTag False "tfoot" $ many pTr + topfoot <- option [] $ pInTag TagsRequired "tfoot" $ many pTr rowsLs <- many pTBody - bottomfoot <- option [] $ pInTag False "tfoot" $ many pTr + bottomfoot <- option [] $ pInTag ClosingTagOptional "tfoot" $ many pTr TagClose _ <- pSatisfy (matchTagClose "table") let rows = concat rowsLs <> topfoot <> bottomfoot rows''' = map (map cellContents) rows |