import Data.Maybe
import Network.Socket
import Network.HTTP.Lucu
-import OpenSSL
import Rakka.Environment
import Rakka.Resource.CheckAuth
import Rakka.Resource.DumpRepos
import Rakka.Resource.Render
import Rakka.Resource.Search
import Rakka.Resource.SystemConfig
--- import Rakka.Resource.TrackBack
import Rakka.Resource.Users
import Rakka.Storage
import Subversion
Executable rakka
Build-Depends:
HsHyperEstraier == 0.4.*,
- HsOpenSSL == 0.10.*,
HsSVN == 0.4.*,
Lucu == 0.7.*,
+ ascii == 0.0.*,
base == 4.3.*,
base-unicode-symbols == 0.2.*,
bytestring == 0.9.*,
containers == 0.4.*,
- dataenc == 0.14.*,
directory == 1.1.*,
filemanip == 0.3.*,
filepath == 1.2.*,
import Data.Map (Map)
import qualified Data.Map as M hiding (Map)
import Data.Maybe
-import OpenSSL.EVP.Base64
-import OpenSSL.EVP.Digest
import Rakka.SystemConfig
import System.Directory
import System.FilePath
+-- -*- coding: utf-8 -*-
+{-# LANGUAGE
+ Arrows
+ , UnicodeSyntax
+ #-}
module Rakka.Page
( PageName
, Page(..)
, parseXmlizedPage
)
where
+import Control.Arrow
+import qualified Data.Ascii as Ascii
+import qualified Data.Text as T
import qualified Data.ByteString.Lazy as Lazy (ByteString)
import qualified Data.ByteString.Lazy as L hiding (ByteString)
import qualified Data.ByteString.Lazy.Char8 as L8 hiding (ByteString)
-import Data.Char
-import Data.Map (Map)
+import Data.Char
+import Data.Map (Map)
import qualified Data.Map as M
-import Data.Time
+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 Rakka.Utils
-import Subversion.Types
-import System.FilePath.Posix
-import Text.XML.HXT.XPath
+import Network.HTTP.Lucu hiding (redirect)
+import Network.URI hiding (fragment)
+import Rakka.Utils
+import Subversion.Types
+import System.FilePath.Posix
+import Text.XML.HXT.DOM.TypeDefs
+import Text.XML.HXT.XPath
+import Text.XML.HXT.Arrow.XmlArrow
+import Prelude.Unicode
+type PageName = T.Text
-type PageName = String
-
-type LanguageTag = String -- See RFC 3066: http://www.ietf.org/rfc/rfc3066.txt
-type LanguageName = String -- i.e. "日本語"
+type LanguageTag = Ascii -- See RFC 3066: http://www.ietf.org/rfc/rfc3066.txt
+type LanguageName = T.Text -- i.e. "日本語"
data Page
, entityContent = content
, entityUpdateInfo = updateInfo
}
- where
- dropWhitespace :: String -> String
- dropWhitespace [] = []
- dropWhitespace (x:xs)
- | x == ' ' || x == '\t' || x == '\n'
- = dropWhitespace xs
- | otherwise
- = x : dropWhitespace xs
+dropWhitespace :: String -> String
+{-# INLINE dropWhitespace #-}
+dropWhitespace = filter ((¬) ∘ isSpace)
parseUpdateInfo :: (ArrowXml a, ArrowChoice a) => a XmlTree UpdateInfo
parseUpdateInfo
uiOldRevision = oldRev
, uiOldName = oldName
}
-
-
import Control.Monad.Trans
import qualified Data.ByteString.Lazy as Lazy
import Network.HTTP.Lucu
-import OpenSSL.EVP.Base64
import Rakka.Environment
import Rakka.Page
import Rakka.Utils
, mkQueryString
)
where
-import qualified Codec.Binary.Url as Url
+import qualified Blaze.ByteString.Builder as BBB
import Control.Arrow
import Control.Arrow.ArrowList
+import Data.Ascii (Ascii)
+import qualified Data.Ascii as A
import qualified Data.ByteString as BS
import qualified Data.ByteString.Unsafe as BS
import qualified Data.ByteString.Lazy as LS
-import Data.List
+import Data.Monoid.Unicode
import qualified Data.Text as T
+import qualified Data.Text.Lazy as LT
import Data.Text.Encoding
import Magic
import Network.HTTP.Lucu
| isUnreserved c = True
| otherwise = False
-mkQueryString ∷ [(T.Text, T.Text)] → String
-{-# INLINEABLE mkQueryString #-}
-mkQueryString = intercalate ";" ∘ map pairToStr
+mkQueryString ∷ [(T.Text, T.Text)] → Ascii
+{-# INLINE mkQueryString #-}
+mkQueryString = A.unsafeFromByteString
+ ∘ BBB.toByteString
+ ∘ flip mkBBB (∅)
where
- pairToStr ∷ (T.Text, T.Text) → String
- {-# INLINE pairToStr #-}
- pairToStr (k, v)
- = encode k ⧺ ('=':encode v)
+ mkBBB ∷ [(T.Text, T.Text)] → BBB.Builder → BBB.Builder
+ {-# INLINEABLE mkBBB #-}
+ mkBBB [] acc = acc
+ mkBBB (kv:[]) acc = acc ⊕ pair kv
+ mkBBB (kv:xs) acc = mkBBB xs (acc ⊕ pair kv ⊕ semicolon)
- encode ∷ T.Text → String
- {-# INLINE encode #-}
- encode = Url.encode ∘ BS.unpack ∘ encodeUtf8
+ pair ∷ (T.Text, T.Text) → BBB.Builder
+ {-# INLINE pair #-}
+ pair (k, v)
+ = encodeText k ⊕ equal ⊕ encodeText v
+
+ encodeText ∷ T.Text → BBB.Builder
+ {-# INLINE encodeText #-}
+ encodeText = BBB.fromByteString ∘ URI.encode ∘ encodeUtf8
import Data.Maybe
import Network.HTTP.Lucu
import Network.URI
-import OpenSSL.EVP.Base64
import Rakka.Page
import Rakka.Storage
import Rakka.SystemConfig