on 8fbfbce help sign in
elk/src/GenerateHtml.hs
32 lines 1.4 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
2module GenerateHtml (generateHtml) where
4import Text.Blaze.Html5 hiding (map)
5import qualified Text.Blaze.Html5 as H
6import Text.Blaze.Html5.Attributes
7import qualified Text.Blaze.Html5.Attributes as A
9css = preEscapedString "* { padding:0; margin:0; \
10 \hyphens: auto; -moz-hyphens: auto;\
11 \ -webkit-hyphens: auto; -ms-hyphens: auto; }\
12 \body { font-family: Arial; }\
13 \a:link {text-decoration: none}\
14 \a:visited {text-decoration: none}\
15 \a:active {text-decoration: none}\
16 \a:hover {text-decoration: underline; color: #ff8f12;}"
18makeScript :: String -> Html
19makeScript s = script ! type_ "text/javascript" ! src (toValue s) $ ""
21generateHtml libLoc title source =
22 docTypeHtml $ do
23 H.head $ do
24 meta ! charset "UTF-8"
25 H.title . toHtml $ title
26 makeScript libLoc
27 (script ! type_ "text/javascript") . preEscapedString $ source
28 H.style ! type_ "text/css" $ css
29 body $ do
30 H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""
31 H.span ! A.id "content" $ ""
32 script ! type_ "text/javascript" $ "Dispatcher.initialize()"