X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki%2FInterpreter%2FBase.hs;h=5daba841ae7021abeabcff9ade57fc75baa29737;hb=43113f26d3e61c96d896724c5509abe67b6a99e7;hp=bb4c4ad1ba24ad184c5ca3cc910c81a2d0371e0e;hpb=89c3c6ff37517012b5a799014c5a6d05d3e2e902;p=Rakka.git
diff --git a/Rakka/Wiki/Interpreter/Base.hs b/Rakka/Wiki/Interpreter/Base.hs
index bb4c4ad..5daba84 100644
--- a/Rakka/Wiki/Interpreter/Base.hs
+++ b/Rakka/Wiki/Interpreter/Base.hs
@@ -3,8 +3,6 @@ module Rakka.Wiki.Interpreter.Base
)
where
-import Control.Arrow
-import Control.Arrow.ListArrow
import Data.Map (Map)
import qualified Data.Map as M
import Data.Maybe
@@ -12,8 +10,7 @@ import Rakka.Page
import Rakka.SystemConfig
import Rakka.Wiki
import Rakka.Wiki.Interpreter
-import Text.XML.HXT.Arrow.XmlArrow
-import Text.XML.HXT.Arrow.XmlNodeSet
+import Text.XML.HXT.Arrow
interpreters :: [Interpreter]
@@ -25,6 +22,8 @@ interpreters = [ lineBreakInterp
, newPageInterp
, editPageInterp
, loginInterp
+ , searchFieldInterp
+ , configurationInterp
]
@@ -57,7 +56,7 @@ pageNameInterp :: Interpreter
pageNameInterp = InlineCommandInterpreter {
iciName = "pageName"
, iciInterpret
- = \ ctx _ -> return $ Text (ctxPageName ctx)
+ = \ ctx _ -> return $ Text (fromMaybe "" $ ctxPageName ctx)
}
@@ -94,7 +93,7 @@ otherLangsInterp
(langName, name) : mergeTables m xs
mkLangList :: [(LanguageName, PageName)] -> BlockElement
- mkLangList xs = List Bullet (map mkLangLink xs)
+ mkLangList = List Bullet . map mkLangLink
mkLangLink :: (LanguageName, PageName) -> ListItem
mkLangLink (langName, name)
@@ -132,7 +131,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,10 +152,43 @@ loginInterp
iciName = "login"
, iciInterpret
= \ _ _ ->
- let attrs = [ ("type" , "button")
- , ("value" , "Login")
- , ("class" , "loginButton")
+ let attrs = [ ("type" , "button")
+ , ("value", "Login")
+ , ("class", "loginButton")
]
in
return (Input attrs)
- }
\ No newline at end of file
+ }
+
+
+--
+searchFieldInterp :: Interpreter
+searchFieldInterp
+ = InlineCommandInterpreter {
+ iciName = "searchField"
+ , iciInterpret
+ = \ _ _ ->
+ let attrs = [ ("type" , "text")
+ , ("class", "searchField")
+ ]
+ in
+ return (Input attrs)
+ }
+
+--
+configurationInterp :: Interpreter
+configurationInterp
+ = InlineCommandInterpreter {
+ iciName = "configuration"
+ , iciInterpret
+ = \ _ _ ->
+ let attrs = [ ("type" , "button")
+ , ("value", "Configuration")
+ , ("class", "configButton")
+ ]
+ in
+ return (Input attrs)
+ }