~singpolyma/xmpp-blog-utils

9591d1a0432d644e520bf16cb2aee67988cd9024 — Stephen Paul Weber 2 years ago cb0202f master
Some fixes
2 files changed, 12 insertions(+), 9 deletions(-)

M pubsub-entry-publish.hs
M xmpp-blog-utils.cabal
M pubsub-entry-publish.hs => pubsub-entry-publish.hs +10 -8
@@ 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

M xmpp-blog-utils.cabal => xmpp-blog-utils.cabal +2 -1
@@ 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