]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
Fixed breakage on newer HXT
authorpho <pho@cielonegro.org>
Wed, 11 Nov 2009 05:17:18 +0000 (14:17 +0900)
committerpho <pho@cielonegro.org>
Wed, 11 Nov 2009 05:17:18 +0000 (14:17 +0900)
Ignore-this: bd7856d6c8376ef8fc118a52b901b5c0

darcs-hash:20091111051718-62b54-cdda569b243a5b786435c030d97d5add909454d8.gz

Makefile
Rakka.cabal
Rakka/Resource.hs
Rakka/Resource/PageEntity.hs
Rakka/Resource/Render.hs
Rakka/Resource/Search.hs
Rakka/Resource/TrackBack.hs
Rakka/Storage/Repos.hs
Rakka/Wiki/Formatter.hs
Setup.hs
configure.ac

index 8bb305a19adcc4a1e9e99063f99d277d1a224bab..d7584a8218dc72f3c8c46d74b40cfcc31eaada0e 100644 (file)
--- 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
index 37a87abe2ffcb0f85efdc212f7cbe4df399f0d41..286572a3f95bb5898e600fdb67cdd8da609d9f5e 100644 (file)
@@ -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 <pho at cielonegro dot org>
index c207744da2ab0f4b673c8d3cd5e5354faaaf5f02..0333d6f53068d9daff76eadb5eb4fa56d0e105f5 100644 (file)
@@ -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)
index fdc95b6bb6912d2d62f25d96e8c9c651689ee189..bf7753ffba068984d7573d25260b200d384156e8 100644 (file)
@@ -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
index 3823cb4fa915f80be5b9c9c98e41a73f817fcadc..fdb3d87afca2428192ce49aef855f91e81538a84 100644 (file)
@@ -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) =>
index 7318e30b34845b9bb01aa4ef65fd8b38cd86976d..3f5a869c4def3d64d3e5de0fdd0ae18df1b3754c 100644 (file)
@@ -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
+
 {-
   <searchResult query="foo bar baz"
                 from="0"
@@ -62,12 +68,12 @@ handleSearch :: Environment -> 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
index 145e307c555631af4da708504da1070285da14ea..45cf55c4f7379fbad2f84bbef3f661bd83f6396a 100644 (file)
@@ -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 
index 8664d2480d5b62252b5930e43dbee309a21fe204..756740eb842540f30df5a47c26651cf07c4f28ff 100644 (file)
@@ -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
index 4a3531ce55a8035dfbad67dfd5f9eecc1a44c184..90687f4e8479a1c11593e770b6cf899fd67f71ee 100644 (file)
@@ -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")
index 43dff8c283ee9deb662b07e8259bb36df01a1916..e7cfaf641937191ff4479bae89e0d799af488bf9 100755 (executable)
--- 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 ()
index b578bbceda8a3e15b645fbadf5e18ba417d2664d..bb6e7f68d9ecdb669a4d25ee53069923eacafe37 100644 (file)
@@ -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])