maid 2011.10.13 → 2012.1.19
raw patch · 2 files changed
+11/−13 lines, 2 filesdep ~hack2dep ~hack2-contribdep ~hack2-handler-snap-server
Dependency ranges changed: hack2, hack2-contrib, hack2-handler-snap-server
Files
- maid.cabal +4/−4
- src/maid.hs +7/−9
maid.cabal view
@@ -1,5 +1,5 @@ Name: maid-Version: 2011.10.13+Version: 2012.1.19 Build-type: Simple Synopsis: A simple static web server Description:@@ -21,11 +21,11 @@ build-depends: base >= 4 && < 100 , air >= 2011.6.19 , air-extra- , hack2 >= 2011.6.20- , hack2-contrib >= 2011.10.12+ , hack2 >= 2012.1.19+ , hack2-contrib >= 2012.1.19.1 , data-default -- , hack2-handler-warp- , hack2-handler-snap-server+ , hack2-handler-snap-server >= 2012.1.19 -- , hack2-handler-mongrel2-http
src/maid.hs view
@@ -6,7 +6,7 @@ import Air.TH-import Air.Extra (u2b, b2u, strip)+import Air.Extra (b2u, strip) import Prelude () import Data.Default (def)@@ -25,14 +25,12 @@ import Hack2.Contrib.Response (set_content_type, set_body_bytestring) import Hack2.Contrib.Request (path) import Hack2 hiding (body)-import Data.ByteString.Lazy.Char8 (pack) import System.Posix.Files import Data.List (isInfixOf, sort, (\\))-import Text.HTML.Moe2 hiding ((/), select)+import Text.HTML.Moe2 hiding ((/), select, br) import Control.Monad ((>=>)) import System.Process import System.Directory (doesFileExist, getDirectoryContents, doesDirectoryExist)-import Control.Concurrent import Control.Arrow ((&&&)) import qualified Data.ByteString.Char8 as B @@ -56,7 +54,7 @@ main = do args <- getArgs let { port = - if length args == 0+ if length args == (0 :: Int) then 3000 else read - first args }@@ -81,7 +79,7 @@ let version = "2011.10.12"- moe = "Moe MAX"+ -- moe = "Moe MAX" br = puts "" @@ -175,7 +173,7 @@ -- print _paths - let _full_paths = _paths.map (_path.drop 2 /)+ let _full_paths = _paths.map (_path.drop (2 :: Int) /) is_path_dir_flag <- _full_paths.mapM is_directory @@ -191,13 +189,13 @@ _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)+ let _html = B.pack - dir_template sorted (B.unpack _css) (env.path.B.unpack.unescape_uri) return - def { status = 200 }- .set_body_bytestring html+ .set_body_bytestring _html .set_content_type "text/html; charset=utf-8"