aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-08-05 11:28:03 -0700
committerJohn MacFarlane <[email protected]>2023-08-05 11:28:03 -0700
commit0a1ea3d8ca76540ff6bf619f84d2eabfad1ef70f (patch)
tree8e2c7bc90e8e5c3d27028d69c38a31e15f36678e /src/Text
parentd7a7f5ad194ac91351eea95716d5d8c7cdf4c6d6 (diff)
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
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/HTML/Table.hs4
1 files changed, 3 insertions, 1 deletions
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
)