From: pho Date: Wed, 11 Nov 2009 05:17:18 +0000 (+0900) Subject: Fixed breakage on newer HXT X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=706ee842873fdceb9465cdf6a583176ab855fae2;p=Rakka.git Fixed breakage on newer HXT Ignore-this: bd7856d6c8376ef8fc118a52b901b5c0 darcs-hash:20091111051718-62b54-cdda569b243a5b786435c030d97d5add909454d8.gz --- diff --git a/Makefile b/Makefile index 8bb305a..d7584a8 100644 --- a/Makefile +++ b/Makefile @@ -39,4 +39,4 @@ test: build sdist: Setup ./Setup sdist -.PHONY: build run clean install doc sdist +.PHONY: build run clean install doc sdist test diff --git a/Rakka.cabal b/Rakka.cabal index 37a87ab..286572a 100644 --- a/Rakka.cabal +++ b/Rakka.cabal @@ -1,8 +1,8 @@ Name: Rakka -Synopsis: Wiki engine with Subversion backend +Synopsis: RESTful Wiki engine with Subversion backend Description: - Rakka is a wiki engine with Subversion backend. Its syntax is - similar to MediaWiki. + Rakka is a RESTful wiki engine with Subversion backend. Its syntax + is similar to MediaWiki. Version: 0.1 License: PublicDomain Author: PHO diff --git a/Rakka/Resource.hs b/Rakka/Resource.hs index c207744..0333d6f 100644 --- a/Rakka/Resource.hs +++ b/Rakka/Resource.hs @@ -164,7 +164,7 @@ outputXmlPage tree formatters >>> writeDocumentToString [ (a_indent, v_1) ] ) - output resultStr + output $ UTF8.encodeString resultStr outputXmlPage' :: XmlTree -> IOSArrow XmlTree XmlTree -> Resource () @@ -181,7 +181,7 @@ outputXml tree >>> writeDocumentToString [ (a_indent, v_1) ] ) - output xmlStr + output $ UTF8.encodeString xmlStr getUserID :: Environment -> Resource (Maybe String) diff --git a/Rakka/Resource/PageEntity.hs b/Rakka/Resource/PageEntity.hs index fdc95b6..bf7753f 100644 --- a/Rakka/Resource/PageEntity.hs +++ b/Rakka/Resource/PageEntity.hs @@ -85,7 +85,7 @@ handleRedirect env >>> writeDocumentToString [ (a_indent, v_1) ] ) - output resultStr + output $ UTF8.encodeString resultStr _ -> do BaseURI baseURI <- getSysConf (envSysConf env) let uri = mkPageFragmentURI diff --git a/Rakka/Resource/Render.hs b/Rakka/Resource/Render.hs index 3823cb4..fdb3d87 100644 --- a/Rakka/Resource/Render.hs +++ b/Rakka/Resource/Render.hs @@ -3,6 +3,7 @@ module Rakka.Resource.Render ) where +import qualified Codec.Binary.UTF8.String as UTF8 import Control.Arrow import Control.Arrow.ArrowIO import Control.Arrow.ArrowList @@ -84,7 +85,7 @@ handleRender env name >>> writeDocumentToString [ (a_indent, v_1) ] ) - output xmlStr + output $ UTF8.encodeString xmlStr render :: (ArrowXml a, ArrowChoice a, ArrowIO a) => diff --git a/Rakka/Resource/Search.hs b/Rakka/Resource/Search.hs index 7318e30..3f5a869 100644 --- a/Rakka/Resource/Search.hs +++ b/Rakka/Resource/Search.hs @@ -3,8 +3,9 @@ module Rakka.Resource.Search ) where -import qualified Codec.Binary.UTF8.String as UTF8 +import qualified Codec.Binary.UTF8.Generic as UTF8 import Control.Monad.Trans +import Data.List import Data.Maybe import Data.Time import Network.HTTP.Lucu @@ -45,6 +46,11 @@ maxSectionWindowSize :: Int maxSectionWindowSize = 10 +findQueryParam :: String -> [FormData] -> Maybe String +findQueryParam name qps + = do fd <- find (\ qp -> fdName qp == name) qps + return $ UTF8.toString $ fdContent fd + {- Resource () handleSearch env = do params <- getQueryForm - let query = UTF8.decodeString $ fromMaybe "" $ lookup "q" params - order = fmap UTF8.decodeString (lookup "order" params) + let query = fromMaybe "" $ findQueryParam "q" params + order = findQueryParam "order" params from = fromMaybe 0 - $ fmap read $ lookup "from" params + $ fmap read $ findQueryParam "from" params to = fromMaybe (from + resultsPerSection) - $ fmap read $ lookup "to" params + $ fmap read $ findQueryParam "to" params cond <- liftIO $ mkCond query order from to result <- searchPages (envStorage env) cond diff --git a/Rakka/Resource/TrackBack.hs b/Rakka/Resource/TrackBack.hs index 145e307..45cf55c 100644 --- a/Rakka/Resource/TrackBack.hs +++ b/Rakka/Resource/TrackBack.hs @@ -118,7 +118,7 @@ outputResponse res >>> writeDocumentToString [ (a_indent, v_1) ] ) - output xmlStr + output $ UTF8.encodeString xmlStr where mkResponseTree :: ArrowXml a => a b XmlTree mkResponseTree diff --git a/Rakka/Storage/Repos.hs b/Rakka/Storage/Repos.hs index 8664d24..756740e 100644 --- a/Rakka/Storage/Repos.hs +++ b/Rakka/Storage/Repos.hs @@ -1,3 +1,4 @@ +-- -*- coding: utf-8 -*- module Rakka.Storage.Repos ( findAllPagesInRevision , getDirContentsInRevision @@ -447,7 +448,7 @@ putAttachmentIntoRepository repos userID oldRev pName aName attachment unless exists $ do createParentDirectories path makeFile path - applyText path Nothing (serializeToString attachment) + applyText path Nothing (encodeString $ serializeToString attachment) case ret of Left _ -> return Conflict Right _ -> return NoContent diff --git a/Rakka/Wiki/Formatter.hs b/Rakka/Wiki/Formatter.hs index 4a3531c..90687f4 100644 --- a/Rakka/Wiki/Formatter.hs +++ b/Rakka/Wiki/Formatter.hs @@ -281,7 +281,5 @@ attachXHtmlNS :: (ArrowXml a) => a XmlTree XmlTree attachXHtmlNS = processTopDown (changeQName attach `when` isElem) where attach :: QName -> QName - attach qn = qn { - namePrefix = "xhtml" - , namespaceUri = "http://www.w3.org/1999/xhtml" - } + attach = setNamePrefix' (newXName "xhtml") . + setNamespaceUri' (newXName "http://www.w3.org/1999/xhtml") diff --git a/Setup.hs b/Setup.hs index 43dff8c..e7cfaf6 100755 --- a/Setup.hs +++ b/Setup.hs @@ -4,7 +4,7 @@ import Distribution.Simple import System.Cmd import System.Exit -main = defaultMainWithHooks (defaultUserHooks { runTests = runTestUnit }) +main = defaultMainWithHooks (autoconfUserHooks { runTests = runTestUnit }) where runTestUnit _ _ _ _ = system "./dist/build/RakkaUnitTest/RakkaUnitTest" >> return () diff --git a/configure.ac b/configure.ac index b578bbc..bb6e7f6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Rakka], [], [phonohawk at ps dot sakura dot ne dot jp]) +AC_INIT([Rakka], [], [pho at cielonegro dot org]) AC_CONFIG_SRCDIR([Rakka.cabal])