git.iko.soy/typeable/pandoc
on master help sign in
RST writers: Use grid tables for 1-column tables.

With simple tables, we have a clash with heading syntax. Closes #5936.

commitce0a4f8c4742a26950237196163f7ca213f62551 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 25 Nov 2019, 07:31 (7 years ago) parent659ee98
2 files changed+41−1
src/Text/Pandoc/Writers/RST.hs+1−1 test/command/5936.md+40
src/Text/Pandoc/Writers/RST.hs+1−1
@@ -294,7 +294,7 @@ blockToRST (Table caption aligns widths headers rows) = do
294294 modify $ \st -> st{ stOptions = oldOpts }
295295 return result
296296 opts <- gets stOptions
297− let isSimple = all (== 0) widths
297+ let isSimple = all (== 0) widths && length widths > 1
298298 tbl <- if isSimple
299299 then do
300300 tbl' <- simpleTable opts blocksToDoc headers rows
test/command/5936.mdnew file+40
@@ -0,0 +1,40 @@
1+```
2+% pandoc -f gfm -t rst
3+| Name |
4+| ---- |
5+| Foo |
6+| Bar |
7+| Baz |
8+| Quux |
9+^D
10++------+
11+| Name |
12++======+
13+| Foo |
14++------+
15+| Bar |
16++------+
17+| Baz |
18++------+
19+| Quux |
20++------+
21+```
22+
23+```
24+% pandoc -f gfm -t rst
25+| Name | Number |
26+| ---- | ------ |
27+| Foo | 3 |
28+| Bar | 4 |
29+| Baz | 2 |
30+| Quux | 1 |
31+^D
32+==== ======
33+Name Number
34+==== ======
35+Foo 3
36+Bar 4
37+Baz 2
38+Quux 1
39+==== ======
40+```