1{-# LANGUAGE OverloadedStrings #-}
2module GenerateHtml (generateHtml, body, css) where
4import Text.Blaze (preEscapedToMarkup)
5import Text.Blaze.Html (Html)
6import qualified Text.Blaze.Html5 as H
7import Text.Blaze.Html5 ((!))
8import qualified Text.Blaze.Html5.Attributes as A
14css = H.style ! A.type_ "text/css" $ preEscapedToMarkup
15 ("* { padding:0; margin:0; \
16 \hyphens: auto; -moz-hyphens: auto;\
17 \ -webkit-hyphens: auto; -ms-hyphens: auto; }\
18 \body { font-family: Arial; }\
19 \a:link {text-decoration: none}\
20 \a:visited {text-decoration: none}\
21 \a:active {text-decoration: none}\
22 \a:hover {text-decoration: underline; color: #ff8f12;}" :: String)
24makeScript :: String -> H.Html
25makeScript s = H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""
27-- |This function compiles Elm code into simple HTML.
31-- > generateHtml "/elm-min.js" "Some title" [elmFile|elm-source/somePage.elm|]
32generateHtml :: String -- ^ Location of elm-min.js as expected by the browser
33 -> String -- ^ The page title
34 -> String -- ^ The elm source code.
36generateHtml libLoc title source =
37 let expr = initialize source
39 noscript = either id extract expr
43 H.meta ! A.charset "UTF-8"
44 H.title . H.toHtml $ title
46 H.script ! A.type_ "text/javascript" $ preEscapedToMarkup js
48 H.body $ body noscript
51 H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""
52 H.span ! A.id "content" $ ""
53 H.script ! A.type_ "text/javascript" $ "Dispatcher.initialize()"
54 H.noscript $ preEscapedToMarkup noscript
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list