summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/CSV.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-08-10 12:04:08 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-08-10 15:01:14 -0700
commitdee4cbc8549d782d9c3f2e9072b2c141ea4f18ad (patch)
treeacc5eb2c01d99c0cea75e2493ff51f09e7916351 /src/Text/Pandoc/CSV.hs
parenta5790dd30893cf7143eb64a46fb137caf131a624 (diff)
RST reader: implement csv-table directive.
Most attributes are supported, including `:file:` and `:url:`. A (probably insufficient) test case has been added. Closes #3533.
Diffstat (limited to 'src/Text/Pandoc/CSV.hs')
-rw-r--r--src/Text/Pandoc/CSV.hs8
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