X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Rakka.git;a=blobdiff_plain;f=Rakka%2FPage.hs;h=b4c88fcc5f2fef07de28d67825e62b68f6c03112;hp=f845f7eee589b7d81a141ca653a7854a97213392;hb=HEAD;hpb=42f51754dea02201aececaacbf194d714cd58aaf diff --git a/Rakka/Page.hs b/Rakka/Page.hs index f845f7e..b4c88fc 100644 --- a/Rakka/Page.hs +++ b/Rakka/Page.hs @@ -51,12 +51,12 @@ import Data.Text (Text) import qualified Data.Text as T import Data.Text.Encoding import Data.Time +import qualified Data.Time.W3C as W3C import Network.HTTP.Lucu hiding (redirect) import Network.URI hiding (fragment) -import OpenSSL.EVP.Base64 +import OpenSSL.EVP.Base64 import Prelude.Unicode import Rakka.Utils -import Rakka.W3CDateTime import Subversion.Types import System.FilePath.Posix import Text.XML.HXT.Arrow.XmlArrow @@ -67,7 +67,6 @@ type PageName = Text type LanguageTag = CI Text -- See RFC 3066: http://www.ietf.org/rfc/rfc3066.txt type LanguageName = Text -- i.e. "日本語" - data Page = Redirection { redirName :: !PageName @@ -94,7 +93,6 @@ data Page } deriving (Show, Eq) - data UpdateInfo = UpdateInfo { uiOldRevision :: !RevNum @@ -252,7 +250,7 @@ xmlizePage += sattr "redirect" (T.unpack $ redirDest page ) += sattr "isLocked" (yesOrNo $ redirIsLocked page) += sattr "revision" (show $ redirRevision page) - += sattr "lastModified" (formatW3CDateTime lastMod) + += sattr "lastModified" (W3C.format lastMod) )) -<< () xmlizeEntity :: (ArrowXml a, ArrowChoice a, ArrowIO a) => a Page XmlTree @@ -278,7 +276,7 @@ xmlizePage += sattr "isLocked" (yesOrNo $ entityIsLocked page) += sattr "isBinary" (yesOrNo $ entityIsBinary page) += sattr "revision" (show $ entityRevision page) - += sattr "lastModified" (formatW3CDateTime lastMod) + += sattr "lastModified" (W3C.format lastMod) += ( case entitySummary page of Just s -> eelem "summary" += txt s Nothing -> none @@ -378,14 +376,6 @@ parseEntity , entityContent = content , entityUpdateInfo = updateInfo } - where - dropWhitespace :: String -> String - dropWhitespace [] = [] - dropWhitespace (x:xs) - | x == ' ' || x == '\t' || x == '\n' - = dropWhitespace xs - | otherwise - = x : dropWhitespace xs parseUpdateInfo ∷ (ArrowXml (⇝), ArrowChoice (⇝)) ⇒ XmlTree ⇝ UpdateInfo parseUpdateInfo @@ -397,3 +387,7 @@ parseUpdateInfo uiOldRevision = oldRev , uiOldName = T.pack <$> oldName } + +dropWhitespace :: String -> String +{-# INLINE dropWhitespace #-} +dropWhitespace = filter ((¬) ∘ isSpace)