RST reader: implement csv-table directive.

Most attributes are supported, including `:file:` and `:url:`.
A (probably insufficient) test case has been added.

Closes #3533.
This commit is contained in:
John MacFarlane
2017-08-10 15:01:14 -07:00
parent a5790dd308
commit dee4cbc854
4 changed files with 120 additions and 48 deletions
+4
View File
@@ -0,0 +1,4 @@
"Albatross", 2.99, "On a stick!"
"Crunchy Frog", 1.49, "If we took the bones out, it wouldn't be
crunchy, now would it?"
1 Albatross 2.99 On a stick!
2 Crunchy Frog 1.49 If we took the bones out, it wouldn't be crunchy, now would it?
+55
View File
@@ -0,0 +1,55 @@
```
% pandoc -f rst -t native
.. csv-table:: Test
:widths: 10, 5, 10
:header: Flavor,Price,Slogan
:file: command/3533-rst-csv-tables.csv
^D
[Table [Str "Test"] [AlignDefault,AlignDefault,AlignDefault] [0.4,0.2,0.4]
[[Plain [Str "Flavor"]]
,[Plain [Str "Price"]]
,[Plain [Str "Slogan"]]]
[[[Plain [Str "Albatross"]]
,[Plain [Str "2.99"]]
,[Plain [Str "On",Space,Str "a",Space,Str "stick!"]]]
,[[Plain [Str "Crunchy",Space,Str "Frog"]]
,[Plain [Str "1.49"]]
,[Plain [Str "If",Space,Str "we",Space,Str "took",Space,Str "the",Space,Str "bones",Space,Str "out,",Space,Str "it",Space,Str "wouldn't",Space,Str "be",SoftBreak,Str "crunchy,",Space,Str "now",Space,Str "would",Space,Str "it?"]]]]]
```
```
% pandoc -f rst -t native
.. csv-table:: Test
:header-rows: 1
:quote: '
:delim: space
'' 'a' 'b'
'cat''s' 3 4
'dog''s' 2 3
^D
[Table [Str "Test"] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
[[]
,[Plain [Str "a"]]
,[Plain [Str "b"]]]
[[[Plain [Str "cat's"]]
,[Plain [Str "3"]]
,[Plain [Str "4"]]]
,[[Plain [Str "dog's"]]
,[Plain [Str "2"]]
,[Plain [Str "3"]]]]]
```
```
% pandoc -f rst -t native
.. csv-table:: Test
:escape: \
"1","\""
^D
[Table [Str "Test"] [AlignDefault,AlignDefault] [0.0,0.0]
[]
[[[Plain [Str "1"]]
,[Plain [Str "\""]]]]]
```