aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2018-02-23 16:26:11 +0100
committerFélix Sipma <felix.sipma@no-log.org>2018-02-23 16:26:56 +0100
commitc0ab31a9c19da6dc9f9f29df5304f07c0415c1d7 (patch)
treede46aa5bc581d9b9c86dfd61d29c0f7628ec62fa
parent2d3cc8921392f9edeca2c0357f89aeeea6f23bde (diff)
upgrade pandoc version
-rw-r--r--perfeed.cabal2
-rw-r--r--src/Convert.hs18
2 files changed, 13 insertions, 7 deletions
diff --git a/perfeed.cabal b/perfeed.cabal
index b8e932d..d5906dd 100644
--- a/perfeed.cabal
+++ b/perfeed.cabal
@@ -47,7 +47,7 @@ library
, monad-logger
, mtl
, optparse-applicative
- , pandoc >= 1.14
+ , pandoc >= 2.0
, path
, persistent
, persistent-sqlite
diff --git a/src/Convert.hs b/src/Convert.hs
index 3c12c9f..69c39a9 100644
--- a/src/Convert.hs
+++ b/src/Convert.hs
@@ -8,7 +8,7 @@ module Convert
) where
import Protolude
-import Text.Pandoc ( writeMarkdown, readHtml, def)
+import Text.Pandoc ( writeMarkdown, readHtml, def, runPure )
import Lucid
import Control.Monad.Logger ( MonadLogger, logError )
import Types ( Entry (..)
@@ -19,11 +19,17 @@ import Types ( Entry (..)
htmlToText :: MonadLogger m => LText -> m LText
-htmlToText html = case readHtml def (toS html) of
- Left err -> do
- $logError (show err)
- return ""
- Right p -> return $ toS (writeMarkdown def p)
+htmlToText html = do
+ case runPure (readHtml def (toS html)) of
+ Left err -> do
+ $logError (show err)
+ return ""
+ Right p -> do
+ case runPure (writeMarkdown def p) of
+ Left err -> do
+ $logError (show err)
+ return ""
+ Right md -> return $ toS md
contentToTextAsText :: MonadLogger m => Content -> m LText
contentToTextAsText (TextContent t) = return t