Changeset 1156 for lang/haskell
- Timestamp:
- 11/05/07 20:35:41 (13 months ago)
- Location:
- lang/haskell/blosxkel
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/haskell/blosxkel/blosxkel.hs
r1155 r1156 19 19 -- ref. http://i.loveruby.net/ja/stdhaskell/samples/lazylines/Template.hs.html 20 20 fillFlavour :: String -> String -> [(String, String)] -> IO String 21 fillFlavour place flavourparams = return . fill =<< (readFile $ place ++ "." ++ flavour)21 fillFlavour flavour place params = return . fill =<< (readFile $ place ++ "." ++ flavour) 22 22 where 23 23 fill "" = "" … … 75 75 } 76 76 77 applyStory :: Entry -> IO String78 applyStory e = fillFlavour "story" "html" [("title", title e),79 ("body", concat (body e)),80 ("time", formatCalendarTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" (toUTCTime (time e))),81 ("path", path e)]77 applyStory :: (String -> [(String, String)] -> IO String) -> Entry -> IO String 78 applyStory fill e = fill "story" [("title", title e), 79 ("body", concat (body e)), 80 ("time", formatCalendarTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" (toUTCTime (time e))), 81 ("path", path e)] 82 82 83 83 cgiMain :: CGI CGIResult … … 85 85 { 86 86 ; entries <- liftIO $ getTextFileEntries "data" 87 ; ct <- liftIO $ fill Flavour "content_type" "html" []88 ; ch <- liftIO $ fill Flavour "head" "html" [("title", "hogehoge")]89 ; cs <- liftIO $ mapM applyStory$ take 7 $ reverse $ sortBy (\a b -> compare (time a) (time b)) entries90 ; cf <- liftIO $ fill Flavour "foot" "html" [("title", "hogehoge")]87 ; ct <- liftIO $ fill "content_type" [] 88 ; ch <- liftIO $ fill "head" [] 89 ; cs <- liftIO $ mapM (applyStory fill) $ take 7 $ reverse $ sortBy (\a b -> compare (time a) (time b)) entries 90 ; cf <- liftIO $ fill "foot" [] 91 91 ; setHeader "Content-Type" ct 92 92 ; output $ concat $ [ch, concat cs, cf] 93 } 93 } where 94 fill place params = fillFlavour "html" place (params ++ [("title", "Blosxkel.hs"), 95 ("version", "aaa")]) 94 96 95 97 main :: IO () -
lang/haskell/blosxkel/foot.html
r1153 r1156 2 2 3 3 <div id="footer"> 4 <p>$version</p> 4 5 </div> 5 6 </div> -
lang/haskell/blosxkel/head.html
r1155 r1156 93 93 <h1 id="top"><a href="/">$title</a></h1> 94 94 95 <p>$home</p> 96 95 97 <div id="content">
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)