packages feed

Elm 0.1.2 → 0.1.2.1

raw patch · 5 files changed

+65/−60 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Elm.cabal view
@@ -1,6 +1,6 @@  Name:                Elm-Version:             0.1.2+Version:             0.1.2.1 Synopsis:            The Elm language module. Description:         Elm aims to make client-side web-development more pleasant.                      It is a statically/strongly typed, functional reactive
src/Compiler.hs view
@@ -11,7 +11,7 @@ 
 parse :: [String] -> IO ()
 parse ("--help":_) = putStrLn usage
-parse ("--version":_) = putStrLn "The Elm Compiler 0.1.2"
+parse ("--version":_) = putStrLn "The Elm Compiler 0.1.2.1"
 parse [loc,file]
   | "--runtime-location=" `isPrefixOf` loc =
       produceHtml (tail $ dropWhile (/='=') loc) file
@@ -26,7 +26,7 @@   case compile code of
     Left err -> putStrLn err
     Right jsCode -> writeFile (name ++ ".html") . renderHtml $
-                    generateHtml libLoc name jsCode
+                    generateHtml libLoc name code
 
 usageMini :: String
 usageMini =
src/GenerateHtml.hs view
@@ -1,54 +1,59 @@-{-# LANGUAGE OverloadedStrings #-}
-module GenerateHtml (generateHtml, body, css) where
-
-import Text.Blaze (preEscapedToMarkup)
-import Text.Blaze.Html (Html)
-import qualified Text.Blaze.Html5 as H
-import Text.Blaze.Html5 ((!))
-import qualified Text.Blaze.Html5.Attributes as A
-
-import Initialize
-import CompileToJS
-import ExtractNoscript
-
-css = H.style ! A.type_ "text/css" $ preEscapedToMarkup
-      ("* { padding:0; margin:0; \
-       \hyphens: auto; -moz-hyphens: auto;\
-       \ -webkit-hyphens: auto; -ms-hyphens: auto; }\
-       \body { font-family: Arial; }\
-       \a:link {text-decoration: none}\
-       \a:visited {text-decoration: none}\
-       \a:active {text-decoration: none}\
-       \a:hover {text-decoration: underline; color: #ff8f12;}" :: String)
-
-makeScript :: String -> H.Html
-makeScript s = H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""
-
--- |This function compiles Elm code into simple HTML.
---
---  Usage example:
---
--- > generateHtml "/elm-min.js" "Some title" [elmFile|elm-source/somePage.elm|]
-generateHtml :: String -- ^ Location of elm-min.js as expected by the browser
-             -> String -- ^ The page title
-             -> String -- ^ The elm source code.
-             -> Html
-generateHtml libLoc title source =
-    let expr = initialize source
-        js = compileToJS expr
-        noscript = either id extract expr
-    in
-    H.docTypeHtml $ do 
-      H.head $ do
-        H.meta ! A.charset "UTF-8"
-        H.title . H.toHtml $ title
-        makeScript libLoc
-        H.script ! A.type_ "text/javascript" $ preEscapedToMarkup js
-        css
-      H.body $ body noscript
-
-body noscript = do
-  H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""
-  H.span ! A.id "content" $ ""
-  H.script ! A.type_ "text/javascript" $ "Dispatcher.initialize()"
-  H.noscript $ preEscapedToMarkup noscript +{-# LANGUAGE OverloadedStrings #-}+module GenerateHtml (generateHtml, body, css, widgetBody) where++import Text.Blaze (preEscapedToMarkup)+import Text.Blaze.Html (Html)+import qualified Text.Blaze.Html5 as H+import Text.Blaze.Html5 ((!))+import qualified Text.Blaze.Html5.Attributes as A++import Initialize+import CompileToJS+import ExtractNoscript++css = H.style ! A.type_ "text/css" $ preEscapedToMarkup+      ("* { padding:0; margin:0; \+       \hyphens: auto; -moz-hyphens: auto;\+       \ -webkit-hyphens: auto; -ms-hyphens: auto; }\+       \body { font-family: Arial; }\+       \a:link {text-decoration: none}\+       \a:visited {text-decoration: none}\+       \a:active {text-decoration: none}\+       \a:hover {text-decoration: underline; color: #ff8f12;}" :: String)++makeScript :: String -> H.Html+makeScript s = H.script ! A.type_ "text/javascript" ! A.src (H.toValue s) $ ""++-- |This function compiles Elm code into simple HTML.+--+--  Usage example:+--+-- > generateHtml "/elm-min.js" "Some title" [elmFile|elm-source/somePage.elm|]+generateHtml :: String -- ^ Location of elm-min.js as expected by the browser+             -> String -- ^ The page title+             -> String -- ^ The elm source code.+             -> Html+generateHtml libLoc title source =+    let expr = initialize source+        js = compileToJS expr+        noscript = either id extract expr+    in+    H.docTypeHtml $ do +      H.head $ do+        H.meta ! A.charset "UTF-8"+        H.title . H.toHtml $ title+        makeScript libLoc+        H.script ! A.type_ "text/javascript" $ preEscapedToMarkup js+        css+      H.body $ body noscript++body noscript = do+  H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""+  H.span ! A.id "content" $ ""+  H.script ! A.type_ "text/javascript" $ "Dispatcher.initialize()"+  H.noscript $ preEscapedToMarkup noscript++widgetBody noscript = do+  H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""+  H.span ! A.id "content" $ ""+  H.noscript $ preEscapedToMarkup noscript
src/Language/Elm.hs view
@@ -71,4 +71,4 @@ toPartsHelper source = (html, css, js)
   where expr = initialize source
         js = compileToJS expr
-        html = body $ either id extract expr
+        html = widgetBody $ either id extract expr
src/Language/Elm/Quasi.hs view
@@ -70,7 +70,7 @@ -- |QuasiQuoter for embedding Elm code inside of Haskell code. -- --  Usage:--- @[elm|main = plaintext "Some elm code"|]@+-- @[elm|main = plaintext \"Some elm code\"|]@ elm :: QuasiQuoter elm = QuasiQuoter { quoteExp = \s -> do     rs <- elmSettings@@ -81,7 +81,7 @@ --  .elm files. -- --  Usage:--- @$(elmFile "elm_source/index.elm")@+-- @$(elmFile \"elm_source/index.elm\")@ elmFile :: FilePath -> Q Exp elmFile fp = do     rs <- elmSettings