X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Rakka.git;a=blobdiff_plain;f=Rakka%2FWiki%2FInterpreter%2FBase.hs;h=bb4c4ad1ba24ad184c5ca3cc910c81a2d0371e0e;hp=6b883c376c270d68a2ecfaa00b112706bb358b66;hb=89c3c6ff37517012b5a799014c5a6d05d3e2e902;hpb=b51bb0c6d9385938eab21c70ed7ea631883260d0 diff --git a/Rakka/Wiki/Interpreter/Base.hs b/Rakka/Wiki/Interpreter/Base.hs index 6b883c3..bb4c4ad 100644 --- a/Rakka/Wiki/Interpreter/Base.hs +++ b/Rakka/Wiki/Interpreter/Base.hs @@ -24,12 +24,13 @@ interpreters = [ lineBreakInterp , otherLangsInterp , newPageInterp , editPageInterp + , loginInterp ] lineBreakInterp :: Interpreter lineBreakInterp = InlineCommandInterpreter { - iciName = "br" + iciName = "br" , iciInterpret = \ _ (InlineCommand _ attrs _) -> return $ LineBreak attrs } @@ -37,7 +38,7 @@ lineBreakInterp = InlineCommandInterpreter { spanInterp :: Interpreter spanInterp = InlineCommandInterpreter { - iciName = "span" + iciName = "span" , iciInterpret = \ _ (InlineCommand _ attrs contents) -> return $ Span attrs contents } @@ -45,7 +46,7 @@ spanInterp = InlineCommandInterpreter { divInterp :: Interpreter divInterp = BlockCommandInterpreter { - bciName = "div" + bciName = "div" , bciInterpret = \ _ (BlockCommand _ attrs contents) -> return $ Div attrs (map Block contents) @@ -54,7 +55,7 @@ divInterp = BlockCommandInterpreter { pageNameInterp :: Interpreter pageNameInterp = InlineCommandInterpreter { - iciName = "pageName" + iciName = "pageName" , iciInterpret = \ ctx _ -> return $ Text (ctxPageName ctx) } @@ -63,7 +64,7 @@ pageNameInterp = InlineCommandInterpreter { otherLangsInterp :: Interpreter otherLangsInterp = BlockCommandInterpreter { - bciName = "inOtherLanguages" + bciName = "inOtherLanguages" , bciInterpret = \ ctx _ -> let linkTable = case ctxMainPage ctx of @@ -107,7 +108,7 @@ otherLangsInterp newPageInterp :: Interpreter newPageInterp = InlineCommandInterpreter { - iciName = "newPage" + iciName = "newPage" , iciInterpret = \ _ (InlineCommand _ args _) -> let label = fromMaybe "Create new page" (lookup "label" args) @@ -128,7 +129,7 @@ newPageInterp editPageInterp :: Interpreter editPageInterp = InlineCommandInterpreter { - iciName = "editPage" + iciName = "editPage" , iciInterpret = \ ctx (InlineCommand _ args _) -> let name = fromMaybe (ctxPageName ctx) (lookup "page" args) @@ -141,3 +142,21 @@ editPageInterp in return (Input attrs) } + + +-- +loginInterp :: Interpreter +loginInterp + = InlineCommandInterpreter { + iciName = "login" + , iciInterpret + = \ _ _ -> + let attrs = [ ("type" , "button") + , ("value" , "Login") + , ("class" , "loginButton") + ] + in + return (Input attrs) + } \ No newline at end of file