Skip to content

Instantly share code, notes, and snippets.

@simonmichael
Created April 16, 2009 00:45
Show Gist options
  • Select an option

  • Save simonmichael/96127 to your computer and use it in GitHub Desktop.

Select an option

Save simonmichael/96127 to your computer and use it in GitHub Desktop.
end of formattedPage:
...
templ <- queryAppState template
sha1 <- case (pgSelectedTab layout, rev) of
(EditTab,Nothing) -> liftIO $ catch (latest fs $ pathForPage page)
(\e -> if e == NotFound
then return ""
else throwIO e)
(EditTab,Just r) -> return r
_ -> return ""
let maybeSetSha1 = if null sha1 then id else T.setAttribute "sha1" sha1
let filledTemp = T.render $
maybeSetSha1 $
T.setAttribute "pagetitle" pageTitle $
T.setAttribute "javascripts" javascriptlinks $
T.setAttribute "pagename" page $
(case user of
Just u -> T.setAttribute "user" u
Nothing -> id) $
(if isPage page then T.setAttribute "ispage" "true" else id) $
(if pgShowPageTools layout then T.setAttribute "pagetools" "true" else id) $
(if pPrintable params then T.setAttribute "printable" "true" else id) $
(if isJust rev then T.setAttribute "nothead" "true" else id) $
(if isJust rev then T.setAttribute "revision" (fromJust rev) else id) $
T.setAttribute "searchbox" (renderHtmlFragment (searchbox +++ gobox)) $
T.setAttribute "exportbox" (renderHtmlFragment $ exportBox page params) $
T.setAttribute "tabs" (renderHtmlFragment tabs) $
T.setAttribute "messages" (renderHtmlFragment htmlMessages) $
T.setAttribute "content" (renderHtmlFragment htmlContents) $
templ
ok $ setContentType "text/html" $ toResponse $ encodeString filledTemp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment