X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FResource%2FPageEntity.hs;h=c805ae5fe9af0ec4f44152c8a7e2278523ecb7a8;hb=88747f2;hp=690695e881bc73c58c6a4c1b127064112fb1e81a;hpb=fcddebcc3cc02ae8d1904b9338334d538019e74a;p=Rakka.git diff --git a/Rakka/Resource/PageEntity.hs b/Rakka/Resource/PageEntity.hs index 690695e..c805ae5 100644 --- a/Rakka/Resource/PageEntity.hs +++ b/Rakka/Resource/PageEntity.hs @@ -2,14 +2,13 @@ module Rakka.Resource.PageEntity ( fallbackPageEntity ) where - -import qualified Codec.Binary.UTF8.String as UTF8 import Control.Monad.Trans import qualified Data.ByteString.Lazy as L hiding (ByteString) import Data.Char import qualified Data.Map as M import Data.Maybe import Data.Time +import qualified Data.Time.W3C as W3C import Network.HTTP.Lucu import Network.URI hiding (path) import Rakka.Environment @@ -18,32 +17,29 @@ import Rakka.Resource import Rakka.Storage import Rakka.SystemConfig import Rakka.Utils -import Rakka.W3CDateTime import Rakka.Wiki.Engine import System.FilePath.Posix import Text.HyperEstraier hiding (getText) -import Text.XML.HXT.Arrow import Text.XML.HXT.XPath fallbackPageEntity :: Environment -> [String] -> IO (Maybe ResourceDef) fallbackPageEntity env path - | null path = return Nothing - | null $ head path = return Nothing - | isLower $ head $ head path = return Nothing -- 先頭の文字が小文字であってはならない + | null name = return Nothing + | isLower $ head name = return Nothing -- 先頭の文字が小文字であってはならない | otherwise = return $ Just $ ResourceDef { resUsesNativeThread = False , resIsGreedy = True - , resGet = Just $ handleGet env (toPageName path) + , resGet = Just $ handleGet env name , resHead = Nothing , resPost = Nothing - , resPut = Just $ handlePut env (toPageName path) - , resDelete = Just $ handleDelete env (toPageName path) + , resPut = Just $ handlePut env name + , resDelete = Just $ handleDelete env name } where - toPageName :: [String] -> PageName - toPageName = decodePageName . dropExtension . joinPath + name :: PageName + name = (dropExtension . UTF8.decodeString . joinPath) path handleGet :: Environment -> PageName -> Resource () @@ -264,7 +260,7 @@ entityToRSS env += ( eelem "dc:date" += ( arrIO (utcToLocalZonedTime . entityLastMod) >>> - arr formatW3CDateTime + arr W3C.format >>> mkText )