@@ -21,6 +21,7 @@ data ELM =
2121 , separate_js :: Bool
2222 , only_js :: Bool
2323 , import_js :: [FilePath]
24+ , generate_noscript :: Bool
2425 }
2526 deriving (Data,Typeable,Show,Eq)
2627
@@ -31,6 +32,7 @@ elm = ELM { make = False &= help "automatically compile dependencies."
3132 , separate_js = False &= help "Compile to separate HTML and JS files."
3233 , only_js = False &= help "Compile only to JavaScript."
3334 , import_js = [] &= typFile &= help "Include a JavaScript file before the body of the Elm program. Can be used many times. Files will be included in the given order."
35+ , generate_noscript = False &= help "Add generated <noscript> tag to HTML output."
3436 } &=
3537 help "Compile Elm programs to HTML, CSS, and JavaScript." &=
3638 summary "The Elm Compiler v0.3.5, (c) Evan Czaplicki"
@@ -40,17 +42,17 @@ main = do
4042 mini <- getDataFileName "elm-runtime-0.3.5.js"
4143 compileArgs mini args
4244
43−compileArgs mini (ELM _ [] _ _ _ _) =
45+compileArgs mini (ELM _ [] _ _ _ _ _) =
4446 putStrLn "Usage: elm [OPTIONS] [FILES]\nFor more help: elm --help"
45−compileArgs mini (ELM make files rtLoc split only js) =
46− mapM_ (fileTo get what js $ fromMaybe mini rtLoc) files
47+compileArgs mini (ELM make files rtLoc split only js nscrpt) =
48+ mapM_ (fileTo get what js nscrpt $ fromMaybe mini rtLoc) files
4749 where get = if make then getModules [] else getModule
4850 what = if only then JS else
4951 if split then Split else HTML
5052
5153data What = JS | HTML | Split
5254
53−fileTo get what jsFiles rtLoc file = do
55+fileTo get what jsFiles noscript rtLoc file = do
5456 ems <- get file
5557 jss <- concat `fmap` mapM readFile jsFiles
5658 case ems of
@@ -61,7 +63,7 @@ fileTo get what jsFiles rtLoc file = do
6163 html = name ++ ".html"
6264 in case what of
6365 JS -> writeFile js $ jss ++ concatMap jsModule ms
64− HTML -> writeFile html . renderHtml $ modulesToHtml "" rtLoc jss ms
66+ HTML -> writeFile html . renderHtml $ modulesToHtml "" rtLoc jss noscript ms
6567 Split -> do
6668 writeFile html . renderHtml $ linkedHtml rtLoc js ms
6769 writeFile js $ jss ++ concatMap jsModule ms