X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki%2FInterpreter%2FBase.hs;h=6feb92a77c82dcec77157cf3f0bff2929328a06f;hb=743f4a87fd557832ce67d6eb51749582820577c4;hp=70951e6884ab1d43936d0d830d35e41e3ac16a50;hpb=b4a3d2cf3854b10d923cb4c546bf1fe32b021a68;p=Rakka.git diff --git a/Rakka/Wiki/Interpreter/Base.hs b/Rakka/Wiki/Interpreter/Base.hs index 70951e6..6feb92a 100644 --- a/Rakka/Wiki/Interpreter/Base.hs +++ b/Rakka/Wiki/Interpreter/Base.hs @@ -23,6 +23,7 @@ interpreters = [ lineBreakInterp , divInterp , pageNameInterp , otherLangsInterp + , newPageInterp , editPageInterp ] @@ -100,6 +101,30 @@ otherLangsInterp = [Inline (PageLink (Just name) Nothing (Just langName))] +-- +newPageInterp :: Interpreter +newPageInterp + = InlineCommandInterpreter { + iciName = "newPage" + , iciInterpret + = \ ctx (InlineCommand _ args _) -> + do BaseURI baseURI <- getSysConf (ctxSysConf ctx) + + let label = fromMaybe "Create new page" (lookup "label" args) + uri = uriToString id baseURI "" + attrs = [ ("type" , "button") + , ("value" , label) + , ("onclick", "Rakka.newPage(\"" ++ uri ++ "\")") + , ("class" , "newButton") + ] + + return (Input attrs) + } + + --