aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-11-23 17:57:13 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2020-11-24 14:17:35 +0100
commit446ef27a3fb69d6ddf2e841dbdb9dc9c6f288928 (patch)
treec581987edacd4b27686a678919501489eda25f8c /src/Text/Pandoc/Readers
parent41237fcc0ed890795f065c0a7f204fa5597defee (diff)
downloadpandoc-446ef27a3fb69d6ddf2e841dbdb9dc9c6f288928.tar.gz
HTML reader: support blocks in caption
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs2
-rw-r--r--src/Text/Pandoc/Readers/HTML/Table.hs10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index e9fefb9c0..177a39be0 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -474,7 +474,7 @@ pHrule = do
return B.horizontalRule
pTable :: PandocMonad m => TagParser m Blocks
-pTable = pTable' inline pCell
+pTable = pTable' block pCell
noColOrRowSpans :: Tag Text -> Bool
noColOrRowSpans t = isNullOrOne "colspan" && isNullOrOne "rowspan"
diff --git a/src/Text/Pandoc/Readers/HTML/Table.hs b/src/Text/Pandoc/Readers/HTML/Table.hs
index bad39bd2d..bebb75df6 100644
--- a/src/Text/Pandoc/Readers/HTML/Table.hs
+++ b/src/Text/Pandoc/Readers/HTML/Table.hs
@@ -18,7 +18,7 @@ import Control.Monad (guard)
import Data.Maybe (fromMaybe)
import Data.Text (Text)
import Text.HTML.TagSoup
-import Text.Pandoc.Builder (Blocks, Inlines)
+import Text.Pandoc.Builder (Blocks)
import Text.Pandoc.Definition
import Text.Pandoc.Class.PandocMonad (PandocMonad (..))
import Text.Pandoc.Parsing
@@ -59,14 +59,14 @@ pColgroup = try $ do
-- | Parses a simple HTML table
pTable' :: PandocMonad m
- => TagParser m Inlines -- ^ Caption parser
+ => TagParser m Blocks -- ^ Caption parser
-> (Text -> TagParser m [(Alignment, Blocks)]) -- ^ Table cell parser
-> TagParser m Blocks
-pTable' inline pCell = try $ do
+pTable' block pCell = try $ do
TagOpen _ attribs' <- pSatisfy (matchTagOpen "table" [])
let attribs = toAttr attribs'
skipMany pBlank
- caption <- option mempty $ pInTags "caption" inline <* skipMany pBlank
+ 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 >>
@@ -104,7 +104,7 @@ pTable' inline pCell = try $ do
let toRow = Row nullAttr . map B.simpleCell
toHeaderRow l = [toRow l | not (null l)]
return $ B.tableWith attribs
- (B.simpleCaption $ B.plain caption)
+ (B.simpleCaption caption)
(zip aligns widths)
(TableHead nullAttr $ toHeaderRow head')
[TableBody nullAttr 0 [] $ map toRow rows]