diff options
Diffstat (limited to 'src/Text/Pandoc/CSV.hs')
-rw-r--r-- | src/Text/Pandoc/CSV.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/CSV.hs b/src/Text/Pandoc/CSV.hs index 15492ac52..db9226469 100644 --- a/src/Text/Pandoc/CSV.hs +++ b/src/Text/Pandoc/CSV.hs @@ -28,7 +28,7 @@ Simple CSV parser. -} module Text.Pandoc.CSV ( - CSVOptions, + CSVOptions(..), defaultCSVOptions, parseCSV, ParseError @@ -74,7 +74,8 @@ pCSVCell opts = pCSVQuotedCell opts <|> pCSVUnquotedCell opts pCSVQuotedCell :: CSVOptions -> Parser Text pCSVQuotedCell opts = do char (csvQuote opts) - res <- many (satisfy (\c -> c /= csvQuote opts) <|> escaped opts) + res <- many (satisfy (\c -> c /= csvQuote opts && + Just c /= csvEscape opts) <|> escaped opts) char (csvQuote opts) return $ T.pack res @@ -86,7 +87,8 @@ escaped opts = do pCSVUnquotedCell :: CSVOptions -> Parser Text pCSVUnquotedCell opts = T.pack <$> - many (satisfy $ \c -> c /= csvDelim opts && c /= '\r' && c /= '\n') + many (satisfy (\c -> c /= csvDelim opts && c /= '\r' && c /= '\n' + && c /= csvQuote opts)) pCSVDelim :: CSVOptions -> Parser () pCSVDelim opts = do |