From 7093a3b44cbd0b962c53a6e00db51d5de9a840f9 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 12 Dec 2017 15:36:29 -0800 Subject: Markdown: Improved computation of relative cell widths in pipe tables. --- src/Text/Pandoc/Readers/Markdown.hs | 2 +- test/command/3734.md | 6 +++--- test/pipe-tables.native | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index b97a724a4..68f810abe 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1353,7 +1353,7 @@ pipeTable = try $ do numColumns <- getOption readerColumns let widths = if maxlength > numColumns then map (\len -> - fromIntegral (len + 1) / fromIntegral (sum seplengths)) + fromIntegral len / fromIntegral (sum seplengths)) seplengths else replicate (length aligns) 0.0 return (aligns, widths, heads', sequence lines'') diff --git a/test/command/3734.md b/test/command/3734.md index d7e6f20b1..16803256b 100644 --- a/test/command/3734.md +++ b/test/command/3734.md @@ -6,9 +6,9 @@ ^D ---+++ diff --git a/test/pipe-tables.native b/test/pipe-tables.native index 6e39dc475..ca9858d1f 100644 --- a/test/pipe-tables.native +++ b/test/pipe-tables.native @@ -85,7 +85,7 @@ ,[[Plain [Str "4"]] ,[Plain [Str "44"]]]] ,Para [Str "Long",Space,Str "pipe",Space,Str "table",Space,Str "with",Space,Str "relative",Space,Str "widths:"] -,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.1639344262295082,0.18032786885245902,0.6557377049180328] +,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.15517241379310345,0.1724137931034483,0.6724137931034483] [[Plain [Str "Default1"]] ,[Plain [Str "Default2"]] ,[Plain [Str "Default3"]]] -- cgit v1.2.3