module Gargantext.Core.Text.Convert (risPress2csvWrite)
where
+import Data.Either (Either(..))
+import qualified Data.Text as T
import System.FilePath (FilePath()) -- , takeExtension)
+
import Gargantext.Prelude
import Gargantext.Core.Text.Corpus.Parsers.CSV (writeDocs2Csv)
-import Gargantext.Core.Text.Corpus.Parsers (parseFile, FileFormat(..))
+import Gargantext.Core.Text.Corpus.Parsers (parseFile, FileFormat(..), FileType(..))
risPress2csvWrite :: FilePath -> IO ()
-risPress2csvWrite f = parseFile RisPresse (f <> ".ris")
- >>= \hs -> writeDocs2Csv (f <> ".csv") hs
+risPress2csvWrite f = do
+ eContents <- parseFile RisPresse Plain (f <> ".ris")
+ case eContents of
+ Right contents -> writeDocs2Csv (f <> ".csv") contents
+ Left e -> panic $ "Error: " <> (T.pack e)