diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-01-07 10:40:30 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-01-07 10:40:30 -0800 |
commit | c4fdf28815764760751be0a61c180aba0bb57c93 (patch) | |
tree | e19967bac7a4701c9465873b79489298e0227c26 /src/Text/Pandoc | |
parent | a5efd2af11849b6fa55b40d188cc9925bfa4ab9f (diff) | |
download | pandoc-c4fdf28815764760751be0a61c180aba0bb57c93.tar.gz |
Markdown reader: renormalize table column widths if they exceed 100%.
Closes #2626.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 7b1341af4..77c3a1016 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1452,11 +1452,16 @@ table = try $ do caption <- case frontCaption of Nothing -> option (return mempty) tableCaption Just c -> return c + -- renormalize widths if greater than 100%: + let totalWidth = sum widths + let widths' = if totalWidth < 1 + then widths + else map (/ totalWidth) widths return $ do caption' <- caption heads' <- heads lns' <- lns - return $ B.table caption' (zip aligns widths) heads' lns' + return $ B.table caption' (zip aligns widths') heads' lns' -- -- inline |