{-# LANGUAGE ExtendedDefaultRules #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
module Knit.Report.Input.Html
(
addStrictTextHtml
, addLazyTextHtml
, htmlReaderOptions
, htmlReaderOptionsWithHeader
)
where
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import qualified Text.Pandoc as P
import qualified Text.Pandoc.Extensions as PA
import qualified Polysemy as P
import qualified Knit.Effect.Pandoc as PE
import qualified Knit.Effect.PandocMonad as PM
htmlReaderOptions :: P.ReaderOptions
htmlReaderOptions :: ReaderOptions
htmlReaderOptions =
ReaderOptions
forall a. Default a => a
P.def { readerExtensions :: Extensions
P.readerExtensions = [Extension] -> Extensions
PA.extensionsFromList [Extension
PA.Ext_raw_html] }
htmlReaderOptionsWithHeader :: P.ReaderOptions
= ReaderOptions
htmlReaderOptions { readerStandalone :: Bool
P.readerStandalone = Bool
True }
addStrictTextHtml
:: (PM.PandocEffects effs, P.Member PE.ToPandoc effs)
=> T.Text
-> P.Sem effs ()
addStrictTextHtml :: Text -> Sem effs ()
addStrictTextHtml = PandocReadFormat Text -> ReaderOptions -> Text -> Sem effs ()
forall (effs :: [(* -> *) -> * -> *]) a.
Member ToPandoc effs =>
PandocReadFormat a -> ReaderOptions -> a -> Sem effs ()
PE.addFrom PandocReadFormat Text
PE.ReadHtml ReaderOptions
htmlReaderOptions
addLazyTextHtml
:: (PM.PandocEffects effs, P.Member PE.ToPandoc effs)
=> LT.Text
-> P.Sem effs ()
addLazyTextHtml :: Text -> Sem effs ()
addLazyTextHtml = Text -> Sem effs ()
forall (effs :: [(* -> *) -> * -> *]).
(PandocEffects effs, Member ToPandoc effs) =>
Text -> Sem effs ()
addStrictTextHtml (Text -> Sem effs ()) -> (Text -> Text) -> Text -> Sem effs ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text
LT.toStrict