aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-23 14:59:51 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-23 14:59:51 +0100
commite92941a9ca75560d6de99b86061492ec49ef1525 (patch)
treed2bb416465b382302b0a9387f72efd560c498e04
parente180a2efa6477dd08b7c6c41816d6cfdf9f24afd (diff)
downloadpandoc-e92941a9ca75560d6de99b86061492ec49ef1525.tar.gz
Grid tables: remove unnecessary extra space in cells.
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs2
-rw-r--r--test/tables-rstsubset.native8
-rw-r--r--test/tables.rst68
3 files changed, 39 insertions, 39 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 299c6faaf..7e08724d8 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -249,7 +249,7 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
let numChars [] = 0
numChars xs = maximum . map offset $ xs
let widthsInChars' =
- map ((+2) . numChars) $ transpose (rawHeaders' : rawRows')
+ map numChars $ transpose (rawHeaders' : rawRows')
if sum widthsInChars' > writerColumns opts
then -- use even widths
handleGivenWidths
diff --git a/test/tables-rstsubset.native b/test/tables-rstsubset.native
index 4f095c798..d9bb9f2fb 100644
--- a/test/tables-rstsubset.native
+++ b/test/tables-rstsubset.native
@@ -1,5 +1,5 @@
[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
+,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,8.75e-2,0.1125,0.125]
[[Plain [Str "Right"]]
,[Plain [Str "Left"]]
,[Plain [Str "Center"]]
@@ -17,7 +17,7 @@
,[Plain [Str "1"]]
,[Plain [Str "1"]]]]
,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
+,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,8.75e-2,0.1125,0.125]
[[Plain [Str "Right"]]
,[Plain [Str "Left"]]
,[Plain [Str "Center"]]
@@ -35,7 +35,7 @@
,[Plain [Str "1"]]
,[Plain [Str "1"]]]]
,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
-,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
+,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,8.75e-2,0.1125,0.125]
[[Plain [Str "Right"]]
,[Plain [Str "Left"]]
,[Plain [Str "Center"]]
@@ -81,7 +81,7 @@
,[Plain [Str "5.0"]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",SoftBreak,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",SoftBreak,Str "between",Space,Str "rows."]]]]
,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,0.1,0.1,0.1]
+,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [7.5e-2,7.5e-2,7.5e-2,7.5e-2]
[[]
,[]
,[]
diff --git a/test/tables.rst b/test/tables.rst
index eaef50d28..e76c505aa 100644
--- a/test/tables.rst
+++ b/test/tables.rst
@@ -2,41 +2,41 @@ Simple table with caption:
.. table:: Demonstration of simple table syntax.
- +---------+--------+----------+-----------+
- | Right | Left | Center | Default |
- +=========+========+==========+===========+
- | 12 | 12 | 12 | 12 |
- +---------+--------+----------+-----------+
- | 123 | 123 | 123 | 123 |
- +---------+--------+----------+-----------+
- | 1 | 1 | 1 | 1 |
- +---------+--------+----------+-----------+
+ +-------+------+--------+---------+
+ | Right | Left | Center | Default |
+ +=======+======+========+=========+
+ | 12 | 12 | 12 | 12 |
+ +-------+------+--------+---------+
+ | 123 | 123 | 123 | 123 |
+ +-------+------+--------+---------+
+ | 1 | 1 | 1 | 1 |
+ +-------+------+--------+---------+
Simple table without caption:
-+---------+--------+----------+-----------+
-| Right | Left | Center | Default |
-+=========+========+==========+===========+
-| 12 | 12 | 12 | 12 |
-+---------+--------+----------+-----------+
-| 123 | 123 | 123 | 123 |
-+---------+--------+----------+-----------+
-| 1 | 1 | 1 | 1 |
-+---------+--------+----------+-----------+
++-------+------+--------+---------+
+| Right | Left | Center | Default |
++=======+======+========+=========+
+| 12 | 12 | 12 | 12 |
++-------+------+--------+---------+
+| 123 | 123 | 123 | 123 |
++-------+------+--------+---------+
+| 1 | 1 | 1 | 1 |
++-------+------+--------+---------+
Simple table indented two spaces:
.. table:: Demonstration of simple table syntax.
- +---------+--------+----------+-----------+
- | Right | Left | Center | Default |
- +=========+========+==========+===========+
- | 12 | 12 | 12 | 12 |
- +---------+--------+----------+-----------+
- | 123 | 123 | 123 | 123 |
- +---------+--------+----------+-----------+
- | 1 | 1 | 1 | 1 |
- +---------+--------+----------+-----------+
+ +-------+------+--------+---------+
+ | Right | Left | Center | Default |
+ +=======+======+========+=========+
+ | 12 | 12 | 12 | 12 |
+ +-------+------+--------+---------+
+ | 123 | 123 | 123 | 123 |
+ +-------+------+--------+---------+
+ | 1 | 1 | 1 | 1 |
+ +-------+------+--------+---------+
Multiline table with caption:
@@ -70,13 +70,13 @@ Multiline table without caption:
Table without column headers:
-+-------+-------+-------+-------+
-| 12 | 12 | 12 | 12 |
-+-------+-------+-------+-------+
-| 123 | 123 | 123 | 123 |
-+-------+-------+-------+-------+
-| 1 | 1 | 1 | 1 |
-+-------+-------+-------+-------+
++-----+-----+-----+-----+
+| 12 | 12 | 12 | 12 |
++-----+-----+-----+-----+
+| 123 | 123 | 123 | 123 |
++-----+-----+-----+-----+
+| 1 | 1 | 1 | 1 |
++-----+-----+-----+-----+
Multiline table without column headers: