git.iko.soy/typeable/pandoc
on master help sign in
Grid tables: remove unnecessary extra space in cells.
commite92941a9ca75560d6de99b86061492ec49ef1525 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 23 Mar 2017, 14:59 (10 years ago) parente180a2e
3 files changed+39−39
src/Text/Pandoc/Writers/Shared.hs+1−1 test/tables-rstsubset.native+4−4 test/tables.rst+34−34
src/Text/Pandoc/Writers/Shared.hs+1−1
@@ -249,7 +249,7 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
249249 let numChars [] = 0
250250 numChars xs = maximum . map offset $ xs
251251 let widthsInChars' =
252− map ((+2) . numChars) $ transpose (rawHeaders' : rawRows')
252+ map numChars $ transpose (rawHeaders' : rawRows')
253253 if sum widthsInChars' > writerColumns opts
254254 then -- use even widths
255255 handleGivenWidths
test/tables-rstsubset.native+4−4
@@ -1,5 +1,5 @@
11[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
2−,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]
2+,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]
33 [[Plain [Str "Right"]]
44 ,[Plain [Str "Left"]]
55 ,[Plain [Str "Center"]]
@@ -17,7 +17,7 @@
1717 ,[Plain [Str "1"]]
1818 ,[Plain [Str "1"]]]]
1919,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
20−,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
20+,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,8.75e-2,0.1125,0.125]
2121 [[Plain [Str "Right"]]
2222 ,[Plain [Str "Left"]]
2323 ,[Plain [Str "Center"]]
@@ -35,7 +35,7 @@
3535 ,[Plain [Str "1"]]
3636 ,[Plain [Str "1"]]]]
3737,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
38−,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]
38+,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]
3939 [[Plain [Str "Right"]]
4040 ,[Plain [Str "Left"]]
4141 ,[Plain [Str "Center"]]
@@ -81,7 +81,7 @@
8181 ,[Plain [Str "5.0"]]
8282 ,[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."]]]]
8383,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
84−,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,0.1,0.1,0.1]
84+,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [7.5e-2,7.5e-2,7.5e-2,7.5e-2]
8585 [[]
8686 ,[]
8787 ,[]
test/tables.rst+34−34
@@ -2,41 +2,41 @@ Simple table with caption:
22
33.. table:: Demonstration of simple table syntax.
44
5− +---------+--------+----------+-----------+
6− | Right | Left | Center | Default |
7− +=========+========+==========+===========+
8− | 12 | 12 | 12 | 12 |
9− +---------+--------+----------+-----------+
10− | 123 | 123 | 123 | 123 |
11− +---------+--------+----------+-----------+
12− | 1 | 1 | 1 | 1 |
13− +---------+--------+----------+-----------+
5+ +-------+------+--------+---------+
6+ | Right | Left | Center | Default |
7+ +=======+======+========+=========+
8+ | 12 | 12 | 12 | 12 |
9+ +-------+------+--------+---------+
10+ | 123 | 123 | 123 | 123 |
11+ +-------+------+--------+---------+
12+ | 1 | 1 | 1 | 1 |
13+ +-------+------+--------+---------+
1414
1515Simple table without caption:
1616
17−+---------+--------+----------+-----------+
18−| Right | Left | Center | Default |
19−+=========+========+==========+===========+
20−| 12 | 12 | 12 | 12 |
21−+---------+--------+----------+-----------+
22−| 123 | 123 | 123 | 123 |
23−+---------+--------+----------+-----------+
24−| 1 | 1 | 1 | 1 |
25−+---------+--------+----------+-----------+
17++-------+------+--------+---------+
18+| Right | Left | Center | Default |
19++=======+======+========+=========+
20+| 12 | 12 | 12 | 12 |
21++-------+------+--------+---------+
22+| 123 | 123 | 123 | 123 |
23++-------+------+--------+---------+
24+| 1 | 1 | 1 | 1 |
25++-------+------+--------+---------+
2626
2727Simple table indented two spaces:
2828
2929.. table:: Demonstration of simple table syntax.
3030
31− +---------+--------+----------+-----------+
32− | Right | Left | Center | Default |
33− +=========+========+==========+===========+
34− | 12 | 12 | 12 | 12 |
35− +---------+--------+----------+-----------+
36− | 123 | 123 | 123 | 123 |
37− +---------+--------+----------+-----------+
38− | 1 | 1 | 1 | 1 |
39− +---------+--------+----------+-----------+
31+ +-------+------+--------+---------+
32+ | Right | Left | Center | Default |
33+ +=======+======+========+=========+
34+ | 12 | 12 | 12 | 12 |
35+ +-------+------+--------+---------+
36+ | 123 | 123 | 123 | 123 |
37+ +-------+------+--------+---------+
38+ | 1 | 1 | 1 | 1 |
39+ +-------+------+--------+---------+
4040
4141Multiline table with caption:
4242
@@ -70,13 +70,13 @@ Multiline table without caption:
7070
7171Table without column headers:
7272
73−+-------+-------+-------+-------+
74−| 12 | 12 | 12 | 12 |
75−+-------+-------+-------+-------+
76−| 123 | 123 | 123 | 123 |
77−+-------+-------+-------+-------+
78−| 1 | 1 | 1 | 1 |
79−+-------+-------+-------+-------+
73++-----+-----+-----+-----+
74+| 12 | 12 | 12 | 12 |
75++-----+-----+-----+-----+
76+| 123 | 123 | 123 | 123 |
77++-----+-----+-----+-----+
78+| 1 | 1 | 1 | 1 |
79++-----+-----+-----+-----+
8080
8181Multiline table without column headers:
8282