aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/CSV.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-02-01 07:33:55 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-02-01 07:33:55 -0800
commit4b1f8584a57b3915fba7d085e62665a79178b32e (patch)
treeb42a96cf3fd75f1d450ba25fc0c42f995d415972 /src/Text/Pandoc/CSV.hs
parent22f484e9a9ab94109380e217b6ff88317bb72741 (diff)
downloadpandoc-4b1f8584a57b3915fba7d085e62665a79178b32e.tar.gz
Fix bug in Text.Pandoc.CSV.
Previously an extra blank record would sometimes be inserted at the end.
Diffstat (limited to 'src/Text/Pandoc/CSV.hs')
-rw-r--r--src/Text/Pandoc/CSV.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc/CSV.hs b/src/Text/Pandoc/CSV.hs
index d9bc10200..99324ee2e 100644
--- a/src/Text/Pandoc/CSV.hs
+++ b/src/Text/Pandoc/CSV.hs
@@ -46,10 +46,10 @@ pCSV opts =
(pCSVRow opts `sepEndBy` endline) <* (spaces *> eof)
pCSVRow :: CSVOptions -> Parser [Text]
-pCSVRow opts = notFollowedBy blank >> pCSVCell opts `sepBy` pCSVDelim opts
-
-blank :: Parser ()
-blank = try $ spaces >> (() <$ endline <|> eof)
+pCSVRow opts = do
+ x <- pCSVCell opts
+ xs <- (if T.null x then many1 else many) $ pCSVDelim opts *> pCSVCell opts
+ return (x:xs)
pCSVCell :: CSVOptions -> Parser Text
pCSVCell opts = pCSVQuotedCell opts <|> pCSVUnquotedCell opts