aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-12 15:36:29 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-12-12 15:36:29 -0800
commit7093a3b44cbd0b962c53a6e00db51d5de9a840f9 (patch)
treeeade565cb3ad5f6f52c896f2d13925d12c66f3f7
parente86c337356fc723e366e5f0d6209205bcffe88f3 (diff)
downloadpandoc-7093a3b44cbd0b962c53a6e00db51d5de9a840f9.tar.gz
Markdown: Improved computation of relative cell widths in pipe tables.
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs2
-rw-r--r--test/command/3734.md6
-rw-r--r--test/pipe-tables.native2
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
<table>
<colgroup>
-<col style="width: 15%" />
-<col style="width: 8%" />
-<col style="width: 76%" />
+<col style="width: 14%" />
+<col style="width: 7%" />
+<col style="width: 77%" />
</colgroup>
<thead>
<tr class="header">
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"]]]