diff options
| author | Ruqi <liruqi@gmail.com> | 2023-06-24 23:18:03 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 09:18:03 -0700 |
| commit | f257c97170ba8db3b771135b98b198d5de2bdb5b (patch) | |
| tree | e468be0e400877bab25f46182ef051b304c91fe1 /src/Text | |
| parent | 5246f02f0bb9c176a6d2f6e3d0c03407d8a67445 (diff) | |
Update TableBody RowHeadColumns caculation: change from max to min (#8634)
This change sets RowHeadColumns to the minimum value of each row, which
gives better results in cases where rows have different numbers of leading th tags.
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/Readers/HTML/Table.hs | 4 |
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..e3ed8bc9a 100644 --- a/src/Text/Pandoc/Readers/HTML/Table.hs +++ b/src/Text/Pandoc/Readers/HTML/Table.hs @@ -191,10 +191,12 @@ pTableBody block = try $ do optional $ pSatisfy (matchTagClose "tbody") guard $ isJust mbattribs || not (null bodyheads && null rows) let attribs = fromMaybe [] mbattribs - return $ TableBody (toAttr attribs) (foldr max 0 rowheads) bodyheads rows + return $ TableBody (toAttr attribs) (getMin rowheads) bodyheads rows where getAttribs (TagOpen _ attribs) = attribs getAttribs _ = [] + getMin [] = 0 + getMin (x:xs) = foldr min x xs -- | Parses a simple HTML table pTable :: PandocMonad m |
