packages feed

shakespeare 2.0.0.1 → 2.0.0.3

raw patch · 3 files changed

+24/−83 lines, 3 filesdep −blaze-builderdep −http-typesdep −waidep ~blaze-htmldep ~bytestringdep ~template-haskell

Dependencies removed: blaze-builder, http-types, wai, wai-app-static

Dependency ranges changed: blaze-html, bytestring, template-haskell

Files

Text/Shakespeare/I18N.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeSynonymInstances #-}@@ -362,5 +363,5 @@ instance IsString (SomeMessage master) where     fromString = SomeMessage . T.pack -instance RenderMessage master (SomeMessage master) where+instance master ~ master' => RenderMessage master (SomeMessage master') where     renderMessage a b (SomeMessage msg) = renderMessage a b msg
− app/servius.hs
@@ -1,62 +0,0 @@-{-# LANGUAGE CPP                #-}-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE OverloadedStrings  #-}-{-# LANGUAGE RecordWildCards    #-}-module Main (main) where--import           Blaze.ByteString.Builder.Char.Utf8 (fromLazyText)-import qualified Data.ByteString.Char8              as S8-import           Data.Text                          (Text)-import qualified Data.Text                          as T-import           Data.Text.Encoding                 (decodeUtf8With)-import           Data.Text.Encoding.Error           (lenientDecode)-import qualified Data.Text.Lazy                     as TL-import           Network.HTTP.Types                 (status200)-import           Network.Wai                        (Middleware, Response,-                                                     pathInfo, responseBuilder)-import           Text.Blaze.Html.Renderer.Utf8      (renderHtmlBuilder)-import           Text.Hamlet                        (defaultHamletSettings)-import           Text.Hamlet.RT                     (parseHamletRT,-                                                     renderHamletRT)-import           Text.Lucius                        (luciusRT)-import           WaiAppStatic.CmdLine               (docroot, runCommandLine)--main :: IO ()-main = runCommandLine (shake . docroot)--shake :: FilePath -> Middleware-shake docroot app req-    | any unsafe p = app req-    | null p = app req-    | ".hamlet" `T.isSuffixOf` l = hamlet pr-    | ".lucius" `T.isSuffixOf` l = lucius pr-    | otherwise = app req-  where-    p = pathInfo req-    pr = T.intercalate "/" $ T.pack docroot : p-    l = last p--unsafe :: Text -> Bool-unsafe s-    | T.null s = False-    | T.head s == '.' = True-    | otherwise = T.any (== '/') s--readFileUtf8 :: Text -> IO String-readFileUtf8 fp = do-    bs <- S8.readFile $ T.unpack fp-    let t = decodeUtf8With lenientDecode bs-    return $ T.unpack t--hamlet :: Text -> IO Response-hamlet fp = do-    str <- readFileUtf8 fp-    hrt <- parseHamletRT defaultHamletSettings str-    html <- renderHamletRT hrt [] (error "No URLs allowed")-    return $ responseBuilder status200 [("Content-Type", "text/html; charset=utf-8")] $ renderHtmlBuilder html--lucius :: Text -> IO Response-lucius fp = do-    str <- readFileUtf8 fp-    let text = either error id $ luciusRT (TL.pack str) []-    return $ responseBuilder status200 [("Content-Type", "text/css; charset=utf-8")] $ fromLazyText text
shakespeare.cabal view
@@ -1,5 +1,5 @@ name:            shakespeare-version:         2.0.0.1+version:         2.0.0.3 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -102,26 +102,28 @@     -- cabal configure --enable-tests -ftest_coffee && cabal build && dist/build/test/test     default: False -flag servius-    description: build the servius web server-    default: True+-- Commented out due to concerns that the Hackage page looks too intimidating. -Executable servius-  Main-is:       servius.hs-  hs-source-dirs: app-  if flag(servius)-      buildable: True-  else-      buildable: False-  Build-depends: base            >= 4                  && < 5-               , wai-app-static  >= 2.0.1              && < 2.1-               , bytestring      >= 0.9.1.4-               , text            >= 0.7-               , http-types-               , shakespeare-               , wai             >= 1.3                && < 2.2-               , blaze-html      >= 0.5-               , blaze-builder+-- flag servius+--     description: build the servius web server+--     default: True+--+-- Executable servius+--   Main-is:       servius.hs+--   hs-source-dirs: app+--   if flag(servius)+--       buildable: True+--   else+--       buildable: False+--   Build-depends: base            >= 4                  && < 5+--                , wai-app-static  >= 2.0.1              && < 2.1+--                , bytestring      >= 0.9.1.4+--                , text            >= 0.7+--                , http-types+--                , shakespeare+--                , wai             >= 1.3                && < 2.2+--                , blaze-html      >= 0.5+--                , blaze-builder  test-suite test     hs-source-dirs: test