RST writers: Use grid tables for 1-column tables.

With simple tables, we have a clash with heading syntax.
Closes #5936.
This commit is contained in:
John MacFarlane 2019-11-25 07:31:28 -08:00
parent 659ee98176
commit ce0a4f8c47
2 changed files with 41 additions and 1 deletions

View file

@ -294,7 +294,7 @@ blockToRST (Table caption aligns widths headers rows) = do
modify $ \st -> st{ stOptions = oldOpts }
return result
opts <- gets stOptions
let isSimple = all (== 0) widths
let isSimple = all (== 0) widths && length widths > 1
tbl <- if isSimple
then do
tbl' <- simpleTable opts blocksToDoc headers rows

40
test/command/5936.md Normal file
View file

@ -0,0 +1,40 @@
```
% pandoc -f gfm -t rst
| Name |
| ---- |
| Foo |
| Bar |
| Baz |
| Quux |
^D
+------+
| Name |
+======+
| Foo |
+------+
| Bar |
+------+
| Baz |
+------+
| Quux |
+------+
```
```
% pandoc -f gfm -t rst
| Name | Number |
| ---- | ------ |
| Foo | 3 |
| Bar | 4 |
| Baz | 2 |
| Quux | 1 |
^D
==== ======
Name Number
==== ======
Foo 3
Bar 4
Baz 2
Quux 1
==== ======
```