aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-01-31 12:05:46 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-01-31 12:05:46 -0800
commitd1875b69ec136c19d9b2336ff57e360ff7b7bef6 (patch)
tree7ad12fb51e412c1be6950dd0fabf9b169f976aa5 /src/Text
parent9c8ff53b54836cbe7fa9417784f3204cd041f3ac (diff)
downloadpandoc-d1875b69ec136c19d9b2336ff57e360ff7b7bef6.tar.gz
RST reader: fix handling of header in CSV tables.
The interpretation of this line is not affected by the delim option. Closes #7064.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 707af905f..0f32d993c 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -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