git.iko.soy/typeable/pandoc
on master help sign in
RST reader: fix handling of header in CSV tables.
d1875b6John MacFarlane
src/Text/Pandoc/Readers/RST.hs+5−4
@@ -877,10 +877,11 @@ csvTableDirective top fields rawcsv = do
877 (bs, _) <- fetchItem u
877 (bs, _) <- fetchItem u
878 return $ UTF8.toText bs
878 return $ UTF8.toText bs
879 Nothing -> return rawcsv
879 Nothing -> return rawcsv
880− let res = parseCSV opts (case explicitHeader of
880+ let header' = case explicitHeader of
881− Just h -> h <> "\n" <> rawcsv'
881+ Just h -> parseCSV defaultCSVOptions h
882− Nothing -> rawcsv')
882+ Nothing -> Right []
883+ let res = parseCSV opts rawcsv'
883− case res of
884+ case (<>) <$> header' <*> res of
884 Left e ->
885 Left e ->
885 throwError $ PandocParsecError "csv table" e
886 throwError $ PandocParsecError "csv table" e
886 Right rawrows -> do
887 Right rawrows -> do
test/command/7064.mdnew file+32
@@ -0,0 +1,32 @@
1+```
2+% pandoc -f rst -t html
3+.. csv-table:: Changes
4+ :header: "Version", "Date", "Description"
5+ :widths: 15, 15, 70
6+ :delim: $
7+
8+ 0.1.0 $ 18/02/2013 $ Initial Release
9+^D
10+<table>
11+<caption>Changes</caption>
12+<colgroup>
13+<col style="width: 15%" />
14+<col style="width: 15%" />
15+<col style="width: 70%" />
16+</colgroup>
17+<thead>
18+<tr class="header">
19+<th>Version</th>
20+<th>Date</th>
21+<th>Description</th>
22+</tr>
23+</thead>
24+<tbody>
25+<tr class="odd">
26+<td>0.1.0</td>
27+<td>18/02/2013</td>
28+<td>Initial Release</td>
29+</tr>
30+</tbody>
31+</table>
32+```