, divInterp
, pageNameInterp
, otherLangsInterp
+ , newPageInterp
, editPageInterp
]
= [Inline (PageLink (Just name) Nothing (Just langName))]
+-- <input type="button"
+-- value="Create new page"
+-- onclick="Rakka.newPage(\"http://example.org/\")"
+-- class="newButton" />
+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)
+ }
+
+
-- <input type="button"
-- value="Edit"
-- onclick="Rakka.editPage(\"http://example.org/\", \"Foo\")"