feeds <- arrIO0 (findFeeds (envStorage env)) -< ()
- pageTitle <- listA (readSubPage env) -< (name, Just page, "PageTitle")
- leftSideBar <- listA (readSubPage env) -< (name, Just page, "SideBar/Left")
- rightSideBar <- listA (readSubPage env) -< (name, Just page, "SideBar/Right")
+ pageTitle <- listA (readSubPage env) -< (Just name, Just page, "PageTitle")
+ leftSideBar <- listA (readSubPage env) -< (Just name, Just page, "SideBar/Left")
+ rightSideBar <- listA (readSubPage env) -< (Just name, Just page, "SideBar/Right")
pageBody <- listA (makeMainXHTML (envStorage env) (envSysConf env) (envInterpTable env)) -< page
( eelem "/"
readSubPage :: (ArrowXml a, ArrowChoice a, ArrowIO a) =>
Environment
- -> a (PageName, Maybe XmlTree, PageName) XmlTree
+ -> a (Maybe PageName, Maybe XmlTree, PageName) XmlTree
readSubPage env
= proc (mainPageName, mainPage, subPageName) ->
do subPage <- getPageA (envStorage env) >>> arr fromJust >>> xmlizePage -< (subPageName, Nothing)
let cssHref = [uriToString id (mkObjectURI baseURI styleSheet) ""]
scriptSrc = [uriToString id (baseURI { uriPath = uriPath baseURI </> "js" }) ""]
- pageTitle <- listA (readSubPage env) -< (name, Nothing, "PageTitle")
- leftSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Left")
- rightSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Right")
+ pageTitle <- listA (readSubPage env) -< (Just name, Nothing, "PageTitle")
+ leftSideBar <- listA (readSubPage env) -< (Just name, Nothing, "SideBar/Left")
+ rightSideBar <- listA (readSubPage env) -< (Just name, Nothing, "SideBar/Right")
( eelem "/"
+= ( eelem "html"
let cssHref = [uriToString id (mkObjectURI baseURI styleSheet) ""]
scriptSrc = [uriToString id (baseURI { uriPath = uriPath baseURI </> "js" }) ""]
- pageTitle <- listA (readSubPage env) -< (name, Nothing, "PageTitle")
- leftSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Left")
- rightSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Right")
+ pageTitle <- listA (readSubPage env) -< (Just name, Nothing, "PageTitle")
+ leftSideBar <- listA (readSubPage env) -< (Just name, Nothing, "SideBar/Left")
+ rightSideBar <- listA (readSubPage env) -< (Just name, Nothing, "SideBar/Right")
( eelem "/"
+= ( eelem "html"
wiki <- wikifyPage interpTable -< tree
pName <- getXPathTreesInDoc "/page/@name/text()" >>> getText -< tree
interpreted <- interpretCommands sto sysConf interpTable
- -< (pName, Just tree, Just wiki, wiki)
+ -< (Just pName, Just tree, Just wiki, wiki)
formatWikiBlocks -< (baseURI, interpreted)
Storage
-> SystemConfig
-> InterpTable
- -> a (PageName, Maybe XmlTree, XmlTree) XmlTree
+ -> a (Maybe PageName, Maybe XmlTree, XmlTree) XmlTree
makeSubXHTML sto sysConf interpTable
= proc (mainPageName, mainPage, subPage)
-> do BaseURI baseURI <- getSysConfA sysConf -< ()
-> do BaseURI baseURI <- getSysConfA sysConf -< ()
wiki <- wikifyBin interpTable -< (pageType, pageBin)
interpreted <- interpretCommands sto sysConf interpTable
- -< (name, Nothing, Just wiki, wiki)
+ -< (Just name, Nothing, Just wiki, wiki)
formatWikiBlocks -< (baseURI, interpreted)
Storage
-> SystemConfig
-> InterpTable
- -> a (PageName, Maybe XmlTree, Maybe WikiPage, WikiPage) WikiPage
+ -> a (Maybe PageName, Maybe XmlTree, Maybe WikiPage, WikiPage) WikiPage
interpretCommands sto sysConf interpTable
= proc (name, mainPage, mainWiki, targetWiki)
-> let ctx = InterpreterContext {
-> do wiki <- wikifyPage interpTable -< tree
pName <- getXPathTreesInDoc "/page/@name/text()" >>> getText -< tree
interpreted <- interpretCommands sto sysConf interpTable
- -< (pName, Just tree, Just wiki, wiki)
+ -< (Just pName, Just tree, Just wiki, wiki)
returnA -< concatMap extractFromBlock interpreted
where
extractFromElem :: Element -> [PageName]
data InterpreterContext
= InterpreterContext {
- ctxPageName :: !PageName
+ ctxPageName :: !(Maybe PageName)
, ctxMainPage :: !(Maybe XmlTree)
, ctxMainWiki :: !(Maybe WikiPage)
, ctxTargetWiki :: !WikiPage
pageNameInterp = InlineCommandInterpreter {
iciName = "pageName"
, iciInterpret
- = \ ctx _ -> return $ Text (ctxPageName ctx)
+ = \ ctx _ -> return $ Text (fromMaybe "" $ ctxPageName ctx)
}
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)
= InlineCommandInterpreter {
iciName = "trackbackURL"
, iciInterpret
- = \ ctx _ -> do BaseURI baseURI <- getSysConf (ctxSysConf ctx)
- let uri = mkAuxiliaryURI baseURI ["trackback"] (ctxPageName ctx)
- return $ ExternalLink uri (Just "Trackback URL")
+ = \ ctx _ -> case ctxPageName ctx of
+ Nothing
+ -> return (Text "No trackbacks for this page.")
+ Just name
+ -> do BaseURI baseURI <- getSysConf (ctxSysConf ctx)
+ let uri = mkAuxiliaryURI baseURI ["trackback"] name
+ return $ ExternalLink uri (Just "Trackback URL")
}