From 0a1ea3d8ca76540ff6bf619f84d2eabfad1ef70f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 5 Aug 2023 11:28:03 -0700 Subject: HTML reader: fix bug in calculation of RowHeadColumns. We were adding up cells, not colspans. Note: there may still be incorrect results in the presence of rowspans. See https://github.com/jgm/pandoc/issues/8984#issuecomment-1666467926 --- src/Text/Pandoc/Readers/HTML/Table.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/HTML/Table.hs b/src/Text/Pandoc/Readers/HTML/Table.hs index abe617ecc..99a090f16 100644 --- a/src/Text/Pandoc/Readers/HTML/Table.hs +++ b/src/Text/Pandoc/Readers/HTML/Table.hs @@ -133,7 +133,9 @@ pRow block = try $ do TagOpen _ attribs <- pSatisfy (matchTagOpen "tr" []) <* skipMany pBlank cells <- many (pCell block BodyCell <|> pCell block HeaderCell) TagClose _ <- pSatisfy (matchTagClose "tr") - return ( RowHeadColumns $ length (takeWhile ((== HeaderCell) . fst) cells) + return ( RowHeadColumns $ foldr (\(_, Cell _ _ _ (ColSpan colspan) _) -> + (+ colspan)) 0 + (takeWhile ((== HeaderCell) . fst) cells) , Row (toAttr attribs) $ map snd cells ) -- cgit v1.2.3