git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: support blocks in caption
commit446ef27a3fb69d6ddf2e841dbdb9dc9c6f288928 authorAlbert Krewinkel <albert@zeitkraut.de> dateMon 23 Nov 2020, 17:57 (6 years ago) parent41237fc
2 files changed+6−6
src/Text/Pandoc/Readers/HTML.hs+1−1 src/Text/Pandoc/Readers/HTML/Table.hs+5−5
src/Text/Pandoc/Readers/HTML.hs+1−1
@@ -474,7 +474,7 @@ pHrule = do
474474 return B.horizontalRule
475475
476476pTable :: PandocMonad m => TagParser m Blocks
477−pTable = pTable' inline pCell
477+pTable = pTable' block pCell
478478
479479noColOrRowSpans :: Tag Text -> Bool
480480noColOrRowSpans t = isNullOrOne "colspan" && isNullOrOne "rowspan"
src/Text/Pandoc/Readers/HTML/Table.hs+5−5
@@ -18,7 +18,7 @@ import Control.Monad (guard)
1818import Data.Maybe (fromMaybe)
1919import Data.Text (Text)
2020import Text.HTML.TagSoup
21−import Text.Pandoc.Builder (Blocks, Inlines)
21+import Text.Pandoc.Builder (Blocks)
2222import Text.Pandoc.Definition
2323import Text.Pandoc.Class.PandocMonad (PandocMonad (..))
2424import Text.Pandoc.Parsing
@@ -59,14 +59,14 @@ pColgroup = try $ do
5959
6060-- | Parses a simple HTML table
6161pTable' :: PandocMonad m
62− => TagParser m Inlines -- ^ Caption parser
62+ => TagParser m Blocks -- ^ Caption parser
6363 -> (Text -> TagParser m [(Alignment, Blocks)]) -- ^ Table cell parser
6464 -> TagParser m Blocks
65−pTable' inline pCell = try $ do
65+pTable' block pCell = try $ do
6666 TagOpen _ attribs' <- pSatisfy (matchTagOpen "table" [])
6767 let attribs = toAttr attribs'
6868 skipMany pBlank
69− caption <- option mempty $ pInTags "caption" inline <* skipMany pBlank
69+ caption <- option mempty $ pInTags "caption" block <* skipMany pBlank
7070 widths' <- (mconcat <$> many1 pColgroup) <|> many pCol
7171 let pTh = option [] $ pInTags "tr" (pCell "th")
7272 pTr = try $ skipMany pBlank >>
@@ -104,7 +104,7 @@ pTable' inline pCell = try $ do
104104 let toRow = Row nullAttr . map B.simpleCell
105105 toHeaderRow l = [toRow l | not (null l)]
106106 return $ B.tableWith attribs
107− (B.simpleCaption $ B.plain caption)
107+ (B.simpleCaption caption)
108108 (zip aligns widths)
109109 (TableHead nullAttr $ toHeaderRow head')
110110 [TableBody nullAttr 0 [] $ map toRow rows]