module Clckwrks.IrcBot.PreProcess where
import Control.Monad.Trans
import Control.Applicative
import Clckwrks (ClckT, ClckState)
import Clckwrks.IrcBot.URL
import Data.Attoparsec.Text
import Data.Text (Text)
import Data.Text.Lazy.Builder (Builder)
import qualified Data.Text.Lazy.Builder as B
import Text.Blaze.Html ((!), toValue)
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html.Renderer.Text (renderHtml)
import Web.Routes (showURL)
parseAttr :: Text -> Parser ()
parseAttr name =
do skipMany space
asciiCI name
skipMany space
char '='
skipMany space
width :: Parser H.Attribute
width =
A.width . H.toValue <$> (parseAttr "width" *> (decimal :: Parser Integer))
height :: Parser H.Attribute
height =
A.height . H.toValue <$> (parseAttr "height" *> (decimal :: Parser Integer))
ircBotCmd :: (Monad m) => (IrcBotURL -> [(Text, Maybe Text)] -> Text) -> Text -> ClckT url m Builder
ircBotCmd showURLFn txt =
return $ B.fromString "ircBot does not currently support any markup commands."