]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Interpreter.hs
Implemented more features
[Rakka.git] / Rakka / Wiki / Interpreter.hs
diff --git a/Rakka/Wiki/Interpreter.hs b/Rakka/Wiki/Interpreter.hs
new file mode 100644 (file)
index 0000000..2abfc45
--- /dev/null
@@ -0,0 +1,40 @@
+module Rakka.Wiki.Interpreter
+    ( Interpreter(..)
+
+    , commandName -- private
+    , commandType -- private
+
+    , pureInlineInterp
+    )
+    where
+
+import           Rakka.Page
+import           Rakka.Storage
+import           Rakka.SystemConfig
+import           Rakka.Wiki
+
+
+data Interpreter
+    = InlineCommandInterpreter {
+        iciName      :: String
+      , iciInterpret :: InlineCommand
+                     -> Maybe Page
+                     -> Storage
+                     -> SystemConfig
+                     -> IO InlineElement
+      }
+
+
+commandName :: Interpreter -> String
+commandName (InlineCommandInterpreter name _) = name
+
+
+commandType :: Interpreter -> CommandType
+commandType (InlineCommandInterpreter _ _) = InlineCommandType
+
+
+pureInlineInterp :: String
+                 -> (InlineCommand -> Maybe Page -> InlineElement)
+                 -> Interpreter
+pureInlineInterp name f
+    = InlineCommandInterpreter name $ \ cmd page _ _ -> return $ f cmd page