Created
January 14, 2014 00:35
-
-
Save duk3luk3/8410855 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | Creates a compiler to render a post list with a category headline | |
categoryPostList :: Pattern | |
-> String | |
-> Context String | |
-> ([Item String] -> Compiler [Item String]) | |
-> Compiler String | |
categoryPostList pattern catname postCtx sortFilter = do | |
let catCtx = | |
constField "category" catname `mappend` | |
defaultContext | |
posts <- sortFilter =<< loadAll pattern | |
catTpl <- loadBody "templates/post-by-category.html" | |
itemTpl <- loadBody "templates/post-item.html" | |
applyTemplateList itemTpl postCtx posts | |
>>= applyTemplate catTpl catCtx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment