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
find . -name '*~' -exec rm -f {} \;
install: build
- ./Setup install
+ sudo ./Setup install
test: build
./Setup test
hxt, mtl, network, parsec, stm, unix
Exposed-Modules:
Rakka.Page
+ Rakka.Plugin
Rakka.Storage
Rakka.SystemConfig
Rakka.Utils
--- /dev/null
+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
+ }
wikifyParseError :: ArrowXml a => a ParseError WikiPage
wikifyParseError
- = proc err -> returnA -< [Preformatted [Text (show err)]]
+ = proc err -> returnA -< [Div [("class", "error")]
+ [ Preformatted [Text (show err)] ]]
, bCmdAttributes = tagAttrs
, bCmdContents = xs
}
- _ -> pzero
+
+ Just InlineCommandType
+ -> pzero
+
+ _ -> return $ undefinedCmdErr tagName
)
<|>
(try $ do (tagName, tagAttrs) <- emptyTag
, bCmdAttributes = tagAttrs
, bCmdContents = []
}
- _ -> pzero
+
+ Just InlineCommandType
+ -> pzero
+
+ _ -> return $ undefinedCmdErr tagName
)
<?>
"block command"
<|>
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
isBoring="yes"
isTheme="yes">
<textData>
-/* global configuration ********************************************************/
+/* global configuration *******************************************************/
* {
padding: 0;
margin: 0;
}
-/* layout **********************************************************************/
+/* layout *********************************************************************/
.center {
position: absolute;
overflow: auto;
}
-/* spacing *********************************************************************/
+/* spacing ********************************************************************/
.title {
padding: 5px 20px;
}
margin-top: 1.2em;
}
-/* color and text **************************************************************/
+/* color and text *************************************************************/
* {
font-family: sans-serif;
}
margin: 0 0 0.8em 0;
}
-/* float ***********************************************************************/
+/* float **********************************************************************/
h1, h2, h3, h4, h5, h6 {
clear: both;
}
-/* image ***********************************************************************/
+/* image **********************************************************************/
img {
border-width: 0;
}
.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>