From 9591d1a0432d644e520bf16cb2aee67988cd9024 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 23 Aug 2022 08:41:41 -0500 Subject: [PATCH] Some fixes --- pubsub-entry-publish.hs | 18 ++++++++++-------- xmpp-blog-utils.cabal | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pubsub-entry-publish.hs b/pubsub-entry-publish.hs index e726a70..b383c7a 100644 --- a/pubsub-entry-publish.hs +++ b/pubsub-entry-publish.hs @@ -5,11 +5,11 @@ module Main (main) where import Prelude () import BasicPrelude -import Data.String (fromString) import Data.Default (def) import Text.Blaze ((!), customAttribute) import Data.Time (getZonedTime, ZonedTime) import Data.Time.Format.ISO8601 (iso8601ParseM, iso8601Show) +import Control.Monad.Error.Class (throwError) import qualified Text.Blaze as Blaze import qualified Text.Blaze.Internal as Blaze import qualified Text.Blaze.Renderer.Text as Blaze @@ -59,7 +59,7 @@ instance Blaze.ToMarkup Enclosure where Blaze.customLeaf (s"link") True ! customAttribute (s"rel") (s"enclosure") ! customAttribute (s"type") (Blaze.toValue ty) - ! customAttribute (s"href") (Blaze.toValue ti) + ! customAttribute (s"title") (Blaze.toValue ti) ! customAttribute (s"href") (Blaze.toValue h) data Config = Config { @@ -78,13 +78,15 @@ data Config = Config { pandocReader :: (Pandoc.PandocMonad m) => String - -> Either String (Text -> m Pandoc.Pandoc) -pandocReader readerSpec = do - (theReader, theExtensions) <- Pandoc.getReader readerSpec + -> Text + -> m Pandoc.Pandoc +pandocReader readerSpec txt = do + (theReader, theExtensions) <- Pandoc.getReader (fromString readerSpec) case theReader of - Pandoc.ByteStringReader _ -> Left "No support for binary formats" + Pandoc.ByteStringReader _ -> throwError $ + Pandoc.PandocAppError $ s"No support for binary formats" Pandoc.TextReader r -> - Right $ r $ def { Pandoc.readerExtensions = theExtensions } + r (def { Pandoc.readerExtensions = theExtensions }) txt main :: IO () main = do @@ -93,7 +95,7 @@ main = do xhtml <- case contentXHTML config of Just content -> do - pandoc <- either (ioError . userError) BasicPrelude.id $ Pandoc.runIOorExplode <$> (pandocReader (reader content) <*> pure (source content)) + pandoc <- Pandoc.runIOorExplode (pandocReader (reader content) (source content)) xhtml <- Pandoc.runIOorExplode (Pandoc.writeHtml5 def pandoc) return $ Just (xhtml, pandoc) Nothing -> return Nothing diff --git a/xmpp-blog-utils.cabal b/xmpp-blog-utils.cabal index 383aa86..9fe91fa 100644 --- a/xmpp-blog-utils.cabal +++ b/xmpp-blog-utils.cabal @@ -12,11 +12,12 @@ build-type: Simple common defs default-language: Haskell2010 ghc-options: -Wall -Wno-tabs -Wno-orphans -Werror - build-depends: base >= 4.11 && < 4.12, + build-depends: base >= 4.11 && < 4.14, basic-prelude >= 0.7 && < 0.8, blaze-markup >= 0.8 && < 0.9, data-default >= 0.7 && < 0.8, dhall >= 1.37 && < 2.0, + mtl >= 1.2 && < 3.0, pandoc >= 2.2 && < 3.0, text >= 1.2 && < 2.0, time >= 1.9 && < 2.0 -- 2.34.5