From: pho Date: Tue, 23 Oct 2007 08:34:23 +0000 (+0900) Subject: Record before creating Rakka-Base. X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=4e8a07033b0b0ea0961bffb3bab0b6fc9c21afba;p=Rakka.git Record before creating Rakka-Base. darcs-hash:20071023083423-62b54-3b6a6db428be81985866df336f556a160b97c2ac.gz --- diff --git a/Makefile b/Makefile index 8ae8c88..b64ac45 100644 --- 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 diff --git a/Rakka.cabal b/Rakka.cabal index 2a546d8..4d72b21 100644 --- a/Rakka.cabal +++ b/Rakka.cabal @@ -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 index 0000000..930c8e0 --- /dev/null +++ b/Rakka/Plugin.hs @@ -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 + } diff --git a/Rakka/Wiki/Engine.hs b/Rakka/Wiki/Engine.hs index ffaab2f..eb986ea 100644 --- a/Rakka/Wiki/Engine.hs +++ b/Rakka/Wiki/Engine.hs @@ -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)] ]] diff --git a/Rakka/Wiki/Parser.hs b/Rakka/Wiki/Parser.hs index e2e3926..6c5d207 100644 --- a/Rakka/Wiki/Parser.hs +++ b/Rakka/Wiki/Parser.hs @@ -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 diff --git a/defaultPages/StyleSheet/Default b/defaultPages/StyleSheet/Default index 0c324b5..9500b19 100644 --- a/defaultPages/StyleSheet/Default +++ b/defaultPages/StyleSheet/Default @@ -4,13 +4,13 @@ isBoring="yes" isTheme="yes"> -/* 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; } @@ -130,7 +130,7 @@ 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: " +}