packages feed

maid 2011.10.12 → 2011.10.13

raw patch · 2 files changed

+15/−13 lines, 2 filesdep ~hack2-contrib

Dependency ranges changed: hack2-contrib

Files

maid.cabal view
@@ -1,5 +1,5 @@ Name:                 maid-Version:              2011.10.12+Version:              2011.10.13 Build-type:           Simple Synopsis:             A simple static web server Description:@@ -22,7 +22,7 @@                     , air >= 2011.6.19                     , air-extra                     , hack2 >= 2011.6.20-                    , hack2-contrib >= 2011.6.21+                    , hack2-contrib >= 2011.10.12                     , data-default                     -- , hack2-handler-warp                     , hack2-handler-snap-server
src/maid.hs view
@@ -145,11 +145,11 @@ not_found = def { status = 404 }  is_directory :: String -> IO Bool-is_directory = u2b > getFileStatus >=> isDirectory > return+is_directory = getFileStatus >=> isDirectory > return  list_dir :: Application list_dir env = do-  let _path = "." + env.pathInfo .B.unpack.unescape_uri .b2u+  let _path = "." + env.pathInfo .B.unpack.unescape_uri.b2u      -- print _path   @@ -158,7 +158,7 @@     then       return not_found     else do-      directory_exist <- doesDirectoryExist (u2b _path)+      directory_exist <- doesDirectoryExist _path       if not directory_exist         then return not_found         else do@@ -171,18 +171,18 @@               let ls :: String -> IO [String]                   ls s = getDirectoryContents s ^ (\\ [".", ".."])               -              _paths <- ls (u2b _path) ^ map b2u+              _paths <- ls _path                -- print _paths                        let _full_paths = _paths.map (_path.drop 2 /)           -              dir_tags <- _full_paths.mapM is_directory+              is_path_dir_flag <- _full_paths.mapM is_directory -              let tagged = zip _paths dir_tags+              let flagged = zip _paths is_path_dir_flag           -                  dirs = tagged.select snd.sort .map_fst (+ "/")-                  files =  tagged.reject snd.sort +                  dirs = flagged.select snd.sort .map_fst (+ "/")+                  files =  flagged.reject snd.sort                     sorted = dirs + files           @@ -190,12 +190,14 @@                          _css <- if maid_css_exist then B.readFile "maid.css" else return default_css_style             -          +              +              let html = pack - dir_template sorted (B.unpack _css) (env.path.B.unpack.unescape_uri)+                             return - def                 {                   status = 200                 }-                .set_body_bytestring (pack - dir_template sorted (B.unpack _css) (env.path.B.unpack.unescape_uri.b2u))+                .set_body_bytestring html                 .set_content_type "text/html; charset=utf-8"  @@ -212,7 +214,7 @@           xs.mapM_ (\(_path, dir_tag) ->             li - do               -              let path_dom = a ![href - "/" / current_path / _path] - str - _path+              let path_dom = a ! [href - "/" / current_path.b2u / _path] - str - _path                                if dir_tag                 then