{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} module Blog where import BlogStore import Data.Maybe (fromJust) import Data.Text (Text, empty, pack) import Data.Text.Lazy (fromStrict) import Data.Time import Locales import Text.Blaze.Html (preEscapedToHtml) import Text.Hamlet import Text.Markdown import qualified Data.Text as T replace :: Eq a => a -> a -> [a] -> [a] replace x y = map (\z -> if z == x then y else z) show' :: Show a => a -> Text show' = pack . show -- |After this time all entries are Markdown markdownCutoff :: UTCTime markdownCutoff = fromJust $ parseTimeM False defaultTimeLocale "%s" "1367149834" -- blog HTML blogTemplate :: BlogLang -> Text -> Html -> Html blogTemplate lang t_append body = [shamlet| $doctype 5