]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
Record before creating Rakka-Base.
authorpho <pho@cielonegro.org>
Tue, 23 Oct 2007 08:34:23 +0000 (17:34 +0900)
committerpho <pho@cielonegro.org>
Tue, 23 Oct 2007 08:34:23 +0000 (17:34 +0900)
darcs-hash:20071023083423-62b54-3b6a6db428be81985866df336f556a160b97c2ac.gz

Makefile
Rakka.cabal
Rakka/Plugin.hs [new file with mode: 0644]
Rakka/Wiki/Engine.hs
Rakka/Wiki/Parser.hs
defaultPages/StyleSheet/Default

index 8ae8c88066633203c0606cb344ea359762e2a5a7..b64ac4535450423d228b58371e8f85eb9387e204 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,11 @@
 CABAL_FILE = Rakka.cabal
 GHC        = ghc
-EXECUTABLE = ./dist/build/Rakka/rakka
+EXECUTABLE = sudo rakka -p 8989 -l DEBUG
 
 build: .setup-config Setup
        ./Setup build
 
-run: build
-       @echo ".:.:. Let's go .:.:."
+run: install
        $(EXECUTABLE)
 
 .setup-config: $(CABAL_FILE) configure Setup Rakka.buildinfo.in
@@ -23,7 +22,7 @@ clean:
        find . -name '*~' -exec rm -f {} \;
 
 install: build
-       ./Setup install
+       sudo ./Setup install
 
 test: build
        ./Setup test
index 2a546d8d4fec1771b4e31cd53b1db961878f2913..4d72b215f4891d15aa91742f019ca8a558995211 100644 (file)
@@ -29,6 +29,7 @@ Build-Depends:
     hxt, mtl, network, parsec, stm, unix
 Exposed-Modules:
     Rakka.Page
+    Rakka.Plugin
     Rakka.Storage
     Rakka.SystemConfig
     Rakka.Utils
diff --git a/Rakka/Plugin.hs b/Rakka/Plugin.hs
new file mode 100644 (file)
index 0000000..930c8e0
--- /dev/null
@@ -0,0 +1,31 @@
+module Rakka.Plugin
+    ( Plugin(..)
+    , RequestHandler
+    , RequestContext(..)
+    )
+    where
+
+import           Data.Typeable
+import           Network.HTTP.Lucu
+import           Rakka.Wiki.Interpreter
+import           Rakka.Storage
+import           Rakka.SystemConfig
+
+
+data Plugin
+    = Plugin {
+        pinInterpreters    :: ![Interpreter]
+      , pinRequestHandlers :: ![RequestHandler]
+      }
+    deriving (Typeable)
+
+
+type RequestHandler
+    = RequestContext -> [String] -> IO (Maybe ResourceDef)
+
+
+data RequestContext
+    = RequestContext {
+        rcStorage :: !Storage
+      , rcSysConf :: !SystemConfig
+      }
index ffaab2f4edf28a9a41b19be39b223be3999d4e8f..eb986ea0b46c23a36d6acdc336a7ac3abda516ab 100644 (file)
@@ -132,4 +132,5 @@ everywhereM' f x = f x >>= gmapM (everywhereM' f)
 
 wikifyParseError :: ArrowXml a => a ParseError WikiPage
 wikifyParseError 
-    = proc err -> returnA -< [Preformatted [Text (show err)]]
+    = proc err -> returnA -< [Div [("class", "error")]
+                              [ Preformatted [Text (show err)] ]]
index e2e39261929c4fcd37ddde176b1c22f9ec36e59e..6c5d20722c89f8243b8accc45fe193d771b33f8b 100644 (file)
@@ -233,7 +233,11 @@ blockCmd cmdTypeOf
                                        , bCmdAttributes = tagAttrs
                                        , bCmdContents   = xs
                                        }
-                  _   -> pzero
+
+                  Just InlineCommandType
+                      -> pzero
+
+                  _   -> return $ undefinedCmdErr tagName
       )
       <|>
       (try $ do (tagName, tagAttrs) <- emptyTag
@@ -244,7 +248,11 @@ blockCmd cmdTypeOf
                                        , bCmdAttributes = tagAttrs
                                        , bCmdContents   = []
                                        }
-                  _   -> pzero
+
+                  Just InlineCommandType
+                      -> pzero
+
+                  _   -> return $ undefinedCmdErr tagName
       )
       <?>
       "block command"
@@ -260,6 +268,15 @@ blockCmd cmdTypeOf
                  <|>
                  return []
 
+      undefinedCmdErr :: String -> BlockElement
+      undefinedCmdErr name
+          = Div [("class", "error")]
+            [ Paragraph [Text ("The command `" ++ name ++ "' is not defined. " ++
+                               "Ensure that you haven't mistyped and the module " ++
+                               "providing the command is actually loaded.")
+                        ]
+            ]
+
 
 inlineElement :: CommandTypeOf -> Parser InlineElement
 inlineElement cmdTypeOf
index 0c324b5b421eca674d7a62f4197e3eaec576cfd8..9500b194391db6d85884d69ab0c9b837ffb4175d 100644 (file)
@@ -4,13 +4,13 @@
       isBoring="yes"
       isTheme="yes">
   <textData>
-/* global configuration ********************************************************/
+/* global configuration *******************************************************/
 * {
     padding: 0;
     margin: 0;
 }
 
-/* layout **********************************************************************/
+/* layout *********************************************************************/
 .center {
     position: absolute;
     
@@ -57,7 +57,7 @@
     overflow: auto;
 }
 
-/* spacing *********************************************************************/
+/* spacing ********************************************************************/
 .title {
     padding: 5px 20px;
 }
     margin-top: 1.2em;
 }
 
-/* color and text **************************************************************/
+/* color and text *************************************************************/
 * {
     font-family: sans-serif;
 }
@@ -243,12 +243,12 @@ p {
     margin: 0 0 0.8em 0;
 }
 
-/* float ***********************************************************************/
+/* float **********************************************************************/
 h1, h2, h3, h4, h5, h6 {
     clear: both;
 }
 
-/* image ***********************************************************************/
+/* image **********************************************************************/
 img {
     border-width: 0;
 }
@@ -291,5 +291,27 @@ img {
 .imageCaption {
     margin-top: 3px;
 }
+
+/* error **********************************************************************/
+.error {
+    color: red;
+    background-color: white;
+
+    font-weight: bold;
+    
+    border-color: #880000;
+    border-width: 3px;
+    border-style: double;
+
+    padding: 10px;
+}
+
+.error p, .error pre {
+    margin: 0;
+}
+
+.error:before {
+    content: "Error: "
+}
 </textData>
 </page>