[moderatly working HTML code
Ketil Malde **20071217100603] {
hunk ./src/Html.hs 17
+import System.Directory
hunk ./src/Html.hs 22
-htmlize brs = do links <- mapM tabulate1 (concatMap results brs)
- html (hheader brs:links)
+htmlize brs = do makeDirectory "blast"
+ links <- mapM tabulate1 (concatMap results brs)
+ html links
hunk ./src/Html.hs 26
-html x = writeFile "index.html" ("\n"++unlines x++"\n\n")
-hheader brs = "BlastBlast result...
\n"
+makeDirectory f = do
+ createDirectory f `catch` (\e -> fail ("Couldn't create directory: '" ++ f++ "'\n"++show e))
+
+html xs = writeFile "index.html" $ renderHtml document
+ where document = (header << thetitle << "Blast") +++
+ (body << h1 << "Blast results" +++ map mklink xs)
+ mklink x = anchor ! [href (mkdirname x)] << x
hunk ./src/Html.hs 35
-dirname = "blast/"
+mkdirname x = "blast/"++x++".html"
+
hunk ./src/Html.hs 39
-tabulate1 br = do let name = dirname ++ (head . words . toStr . query $ br) ++ ".html"
+tabulate1 br = do let name = (head . words . toStr . query $ br)
hunk ./src/Html.hs 43
-genBrfile f x = return ()
+
+genBrfile fn x = writeFile (mkdirname fn) $ renderHtml $ record x
}