import Data.Maybe
import Data.Time
import Network.HTTP.Lucu.RFC1123DateTime
-import Rakka.Page
import Rakka.Storage
import Rakka.Utils
import Rakka.Wiki
setMax cond items
result <- searchPages sto cond
- pages <- mapM (getPageByHP sto) (srPages result)
-
- mkPageList showSummary pages
+ mkPageList showSummary (srPages result)
}
where
- getPageByHP :: Storage -> HitPage -> IO Page
- getPageByHP sto hp
- = getPage sto (hpPageName hp) (Just (hpPageRev hp)) >>= return . fromJust
-
- mkPageList :: Bool -> [Page] -> IO BlockElement
+ mkPageList :: Bool -> [HitPage] -> IO BlockElement
mkPageList showSummary pages
= do items <- mapM (mkListItem showSummary) pages
return (Div [("class", "recentUpdates")]
[ Block (List Bullet items) ])
- mkListItem :: Bool -> Page -> IO ListItem
+ mkListItem :: Bool -> HitPage -> IO ListItem
mkListItem showSummary page
- = do lastMod <- utcToLocalZonedTime (entityLastMod page)
+ = do lastMod <- utcToLocalZonedTime (hpLastMod page)
return ( [ Inline ( PageLink {
- linkPage = Just (pageName page)
+ linkPage = Just (hpPageName page)
, linkFragment = Nothing
, linkText = Nothing
}
)
]
++
- case (showSummary, entitySummary page) of
+ case (showSummary, hpSummary page) of
(True, Just s)
-> [ Block (Paragraph [Text s]) ]
_ -> []