module Web.Page.Hastache where
import Web.Page.Types
import Text.Hastache
import Text.Hastache.Context
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import Data.Monoid
template :: WebPage LT.Text T.Text
-> LT.Text
-> LT.Text
template page content = mconcat
[ "<!DOCTYPE html>"
, "<html>"
, "<head>"
, initScripts page
, "<title>" <> (LT.fromStrict $ pageTitle page) <> "</title>"
, metaVars page
, favicon page
, beforeStylesScripts page
, styles page
, afterStylesScripts page
, "</head>"
, "<body>"
, content
, bodyScripts page
, "</body>"
, "</html>"
]