on master help sign in
Managed to get Yesod.hs compiling.
commit85f84bca236cb4592bd17750ce30ff1851adb182 authorevancz <info@elm-lang.org> dateTue 29 May 2012, 13:49 (14 years ago) parenta6cf0d2
3 files changed+16−16
elm-yesod/Language/Elm/Yesod.hs+5−6 elm/src/GenerateHtml.hs+10−9 elm/src/Language/Elm.hs+1−1
elm-yesod/Language/Elm/Yesod.hs+5−6
@@ -20,8 +20,7 @@ module Language.Elm.Yesod (toWidget) where
2020import Text.Blaze (preEscapedToMarkup)
2121import Text.Hamlet
2222import Text.Julius
23−import Text.Cassius
24−import Yesod.Widget
23+import Yesod.Widget (toWidgetHead, whamlet, GWidget)
2524import Language.Elm
2625
2726-- |toWidget takes some Elm code in String format and produces a widget. Usage example:
@@ -30,7 +29,7 @@ import Language.Elm
3029toWidget :: String -- ^ The Elm source code
3130 -> GWidget sub master ()
3231toWidget source =
33− let (html, css, js) = toParts source
34− in do toWidgetHead [cassius| css |]
35− toWidgetHead [julius| #{js} |]
36− [whamlet| ^{html} |]
32+ let (html, css, js) = toParts source in
33+ do toWidgetHead [hamlet| #{css} |]
34+ toWidgetHead [julius| #{js} |]
35+ [whamlet| ^{html} |]
elm/src/GenerateHtml.hs+10−9
@@ -11,14 +11,15 @@ import Initialize
1111import CompileToJS
1212import ExtractNoscript
1313
14−css = "* { padding:0; margin:0; \
15− \hyphens: auto; -moz-hyphens: auto;\
16− \ -webkit-hyphens: auto; -ms-hyphens: auto; }\
17− \body { font-family: Arial; }\
18− \a:link {text-decoration: none}\
19− \a:visited {text-decoration: none}\
20− \a:active {text-decoration: none}\
21− \a:hover {text-decoration: underline; color: #ff8f12;}"
14+css = 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)
2223
2324makeScript :: String -> H.Html
2425makeScript s = H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""
@@ -43,7 +44,7 @@ generateHtml libLoc title source =
4344 H.title . H.toHtml $ title
4445 makeScript libLoc
4546 H.script ! A.type_ "text/javascript" $ preEscapedToMarkup js
46− H.style ! A.type_ "text/css" $ preEscapedToMarkup (css :: String)
47+ css
4748 H.body $ body noscript
4849
4950body noscript = do
elm/src/Language/Elm.hs+1−1
@@ -31,7 +31,7 @@ toHtml = generateHtml
3131-- and JavaScript. The HTML is only the contents of the body, so the three
3232-- parts must be combined in a basic HTML skeleton.
3333toParts :: String -- ^ The Elm source code.
34− -> (Html, String, String) -- ^ HTML, CSS, and JavaScript in that order.
34+ -> (Html, Html, String) -- ^ HTML, CSS, and JavaScript in that order.
3535toParts source = (html, css, js)
3636 where expr = initialize source
3737 js = compileToJS expr