RST reader: fix handling of header in CSV tables.
The interpretation of this line is not affected by the delim option. Closes #7064.
This commit is contained in:
parent
9c8ff53b54
commit
d1875b69ec
2 changed files with 37 additions and 4 deletions
|
@ -877,10 +877,11 @@ csvTableDirective top fields rawcsv = do
|
|||
(bs, _) <- fetchItem u
|
||||
return $ UTF8.toText bs
|
||||
Nothing -> return rawcsv
|
||||
let res = parseCSV opts (case explicitHeader of
|
||||
Just h -> h <> "\n" <> rawcsv'
|
||||
Nothing -> rawcsv')
|
||||
case res of
|
||||
let header' = case explicitHeader of
|
||||
Just h -> parseCSV defaultCSVOptions h
|
||||
Nothing -> Right []
|
||||
let res = parseCSV opts rawcsv'
|
||||
case (<>) <$> header' <*> res of
|
||||
Left e ->
|
||||
throwError $ PandocParsecError "csv table" e
|
||||
Right rawrows -> do
|
||||
|
|
32
test/command/7064.md
Normal file
32
test/command/7064.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
```
|
||||
% pandoc -f rst -t html
|
||||
.. csv-table:: Changes
|
||||
:header: "Version", "Date", "Description"
|
||||
:widths: 15, 15, 70
|
||||
:delim: $
|
||||
|
||||
0.1.0 $ 18/02/2013 $ Initial Release
|
||||
^D
|
||||
<table>
|
||||
<caption>Changes</caption>
|
||||
<colgroup>
|
||||
<col style="width: 15%" />
|
||||
<col style="width: 15%" />
|
||||
<col style="width: 70%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Version</th>
|
||||
<th>Date</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>0.1.0</td>
|
||||
<td>18/02/2013</td>
|
||||
<td>Initial Release</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
```
|
Loading…
Reference in a new issue