[edit web page: add next sample and mmm sample PAF01143@nifty.ne.jp**20081222043748 Ignore-this: 8fa2da94b64dba42c4e2b85460defa2e ] { move ./web_page/short_tutorial/first_sample.xhtml.ehs ./web_page/short_tutorial/simple_samples.xhtml.ehs hunk ./web_page/XMLTools.hs 5 +, ehs hunk ./web_page/XMLTools.hs 16 +import System.Process (readProcess) hunk ./web_page/XMLTools.hs 45 - let cont_ = foldr (uncurry gsubRegexPR) cont [ (">", ">"), ("<", "<") ] - return $ "
> cat " ++ file ++ "\n\n" ++ cont_ ++ "
" + let cont_ = foldr (uncurry gsubRegexPR) cont [ (">", ">"), ("<", "<") ] + file_a = "" ++ file ++ "" + return $ "
> cat " ++ file_a ++ "\n\n" ++ cont_ ++ "
" + +ehs :: FilePath -> FilePath -> [ String ] -> String -> IO String +ehs dir file args input = do + ret <- readProcess "ehs" ( [ dir `combine` file ] ++ args ) input + let cmd = if null input then "ehs " else "echo " ++ show input ++ " | ehs " + return $ "
> " ++ cmd ++ file ++ " " ++ unwords args ++ "\n\n" ++ ret ++ "
" addfile ./web_page/samples/hello2.ehs hunk ./web_page/samples/hello2.ehs 1 +Hello, <%= "world" %>! addfile ./web_page/samples/threeTimesSayA.ehs hunk ./web_page/samples/threeTimesSayA.ehs 1 +<%% n = 3 %%> +I say 'a' <%=$ n %> times. +<%=$ replicate n 'a' %>. hunk ./web_page/short_tutorial/Hakefile 12 +samples = [ firstHelloEhs, secondHelloEhs, threeTimesSayAEhs ] hunk ./web_page/short_tutorial/Hakefile 16 -firstSample = "first_sample.xhtml" +firstSample = "simple_samples.xhtml" hunk ./web_page/short_tutorial/Hakefile 18 -firstSampleDepFiles = [ xmlTools, firstHelloEhs ] +secondHelloEhs = "../samples/hello2.ehs" +threeTimesSayAEhs = "../samples/threeTimesSayA.ehs" +firstSampleDepFiles = [ xmlTools, firstHelloEhs, secondHelloEhs, threeTimesSayAEhs ] hunk ./web_page/short_tutorial/Hakefile 39 - file [ "upload" ] targets $ \_ ss -> do + file [ "upload" ] (targets ++ [ "samples_upload" ] ) $ \_ ss -> do hunk ./web_page/short_tutorial/Hakefile 46 - {- hunk ./web_page/short_tutorial/Hakefile 47 - file [ "samples_upload" ] targets $ \_ ss -> do + file [ "samples_upload" ] samples $ \_ ss -> do hunk ./web_page/short_tutorial/Hakefile 51 - -} + address ++ directory ++ "/" ++ projName ++ "/samples/", + user_name, "-p", psswd ]) newers + rawSystemE [ "touch", "upload_done" ] hunk ./web_page/short_tutorial/simple_samples.xhtml.ehs 1 -<% intoBodyNmkCont 1 "first sample" -%> +<% intoBodyNmkCont 2 "simple samples" -%> hunk ./web_page/short_tutorial/simple_samples.xhtml.ehs 3 -

1.1. prepare for first sample

+

2.1. very simple sample: HelloWorld program

hunk ./web_page/short_tutorial/simple_samples.xhtml.ehs 5 +<%== ehs "../samples/" "hello.ehs" [] "" %> +

2.2. next, use <%= %>

+<%== cat "../samples/" "hello2.ehs" %> +<%== ehs "../samples/" "hello2.ehs" [] "" %> + +

2.?. mmm...

+<%== cat "../samples/" "threeTimesSayA.ehs" %> +<%== ehs "../samples/" "threeTimesSayA.ehs" [ "n=5" ] "" %> }