]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Interpreter/Base.hs
preparation for page search
[Rakka.git] / Rakka / Wiki / Interpreter / Base.hs
index bb4c4ad1ba24ad184c5ca3cc910c81a2d0371e0e..b17af3253c1b7031046210d5cd465a67b8467b4b 100644 (file)
@@ -25,6 +25,7 @@ interpreters = [ lineBreakInterp
                , newPageInterp
                , editPageInterp
                , loginInterp
+               , searchFieldInterp
                ]
 
 
@@ -57,7 +58,7 @@ pageNameInterp :: Interpreter
 pageNameInterp = InlineCommandInterpreter {
                    iciName = "pageName"
                  , iciInterpret
-                     = \ ctx _ -> return $ Text (ctxPageName ctx)
+                     = \ ctx _ -> return $ Text (fromMaybe "" $ ctxPageName ctx)
                  }
 
 
@@ -132,7 +133,7 @@ editPageInterp
         iciName = "editPage"
       , iciInterpret
           = \ ctx (InlineCommand _ args _) ->
-            let name  = fromMaybe (ctxPageName ctx) (lookup "page" args)
+            let name  = fromMaybe (fromMaybe "" $ ctxPageName ctx) (lookup "page" args)
                 label = fromMaybe "Edit this page" (lookup "label" args)
                 attrs = [ ("type"   , "button")
                         , ("value"  , label)
@@ -153,9 +154,25 @@ loginInterp
         iciName = "login"
       , iciInterpret
           = \ _ _ ->
-            let attrs = [ ("type"   , "button")
-                        , ("value"  , "Login")
-                        , ("class"  , "loginButton")
+            let attrs = [ ("type" , "button")
+                        , ("value", "Login")
+                        , ("class", "loginButton")
+                        ]
+            in
+              return (Input attrs)
+      }
+
+
+-- <input type="text"
+--        class="searchField" />
+searchFieldInterp :: Interpreter
+searchFieldInterp 
+    = InlineCommandInterpreter {
+        iciName = "searchField"
+      , iciInterpret
+          = \ _ _ ->
+            let attrs = [ ("type" , "text")
+                        , ("class", "searchField")
                         ]
             in
               return (Input attrs)