From 046d146e515f1ffc6e402e0d6f8ecac4ae294f5d Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 5 Apr 2020 12:39:12 +0530 Subject: [PATCH] site.hs: Fix do block indentation Strangely this did not fail locally but failed in build. Signed-off-by: Sanchayan Maity --- site.hs | 146 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/site.hs b/site.hs index 84bf331..3bf4808 100644 --- a/site.hs +++ b/site.hs @@ -8,90 +8,90 @@ main :: IO () main = do E.setLocaleEncoding E.utf8 hakyllWith config $ do - match "images/*" $ do - route idRoute - compile copyFileCompiler + match "images/*" $ do + route idRoute + compile copyFileCompiler - match "css/*" $ compile compressCssCompiler - create ["style.css"] $ do - route idRoute - compile $ do - csses <- loadAll "css/*.css" - makeItem $ unlines $ map itemBody csses + match "css/*" $ compile compressCssCompiler + create ["style.css"] $ do + route idRoute + compile $ do + csses <- loadAll "css/*.css" + makeItem $ unlines $ map itemBody csses - match (fromList ["about.markdown"]) $ do - route $ setExtension "html" - compile $ pandocCompiler - >>= loadAndApplyTemplate "templates/default.html" defaultContext - >>= relativizeUrls - - tags <- buildTags "posts/*" (fromCapture "tags/*.html") - - match "posts/*" $ do - route $ setExtension "html" - compile $ pandocCompiler - >>= loadAndApplyTemplate "templates/post.html" (postCtxWithTags tags) - >>= loadAndApplyTemplate "templates/default.html" (postCtxWithTags tags) - >>= relativizeUrls - - create ["archive.html"] $ do - route idRoute - compile $ do - posts <- recentFirst =<< loadAll "posts/*" - let archiveCtx = - listField "posts" (postCtxWithTags tags) (return posts) `mappend` - constField "title" "Archives" `mappend` - defaultContext - - makeItem "" - >>= loadAndApplyTemplate "templates/archive.html" archiveCtx - >>= loadAndApplyTemplate "templates/default.html" archiveCtx + match (fromList ["about.markdown"]) $ do + route $ setExtension "html" + compile $ pandocCompiler + >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls - match "index.html" $ do - route idRoute - compile $ do - posts <- fmap (take 3) . recentFirst =<< loadAll "posts/*" - let indexCtx = - listField "posts" (postCtxWithTags tags) (return posts) `mappend` - field "tags" (\_ -> renderTagList tags) `mappend` - constField "title" "Welcome" `mappend` - defaultContext + tags <- buildTags "posts/*" (fromCapture "tags/*.html") - getResourceBody - >>= applyAsTemplate indexCtx - >>= loadAndApplyTemplate "templates/default.html" indexCtx + match "posts/*" $ do + route $ setExtension "html" + compile $ pandocCompiler + >>= loadAndApplyTemplate "templates/post.html" (postCtxWithTags tags) + >>= loadAndApplyTemplate "templates/default.html" (postCtxWithTags tags) >>= relativizeUrls - create ["sitemap.xml"] $ do - route idRoute - compile $ do - posts <- recentFirst =<< loadAll "posts/*" - let sitemapCtx = - constField "baseUrl" "sanchayanmaity.gitlab.io" `mappend` - constField "title" "Sitemap" `mappend` - listField "posts" (postCtxWithTags tags) (return posts) `mappend` - (postCtxWithTags tags) + create ["archive.html"] $ do + route idRoute + compile $ do + posts <- recentFirst =<< loadAll "posts/*" + let archiveCtx = + listField "posts" (postCtxWithTags tags) (return posts) `mappend` + constField "title" "Archives" `mappend` + defaultContext - makeItem "" - >>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx - >>= cleanIndexHtmls + makeItem "" + >>= loadAndApplyTemplate "templates/archive.html" archiveCtx + >>= loadAndApplyTemplate "templates/default.html" archiveCtx + >>= relativizeUrls - match "templates/*" $ compile templateBodyCompiler + match "index.html" $ do + route idRoute + compile $ do + posts <- fmap (take 3) . recentFirst =<< loadAll "posts/*" + let indexCtx = + listField "posts" (postCtxWithTags tags) (return posts) `mappend` + field "tags" (\_ -> renderTagList tags) `mappend` + constField "title" "Welcome" `mappend` + defaultContext - tagsRules tags $ \tag pattern -> do - let title = "Posts tagged \"" ++ tag ++ "\"" - route idRoute - compile $ do - posts <- recentFirst =<< loadAll pattern - let ctx = constField "title" title - `mappend` listField "posts" (postCtxWithTags tags) (return posts) - `mappend` defaultContext + getResourceBody + >>= applyAsTemplate indexCtx + >>= loadAndApplyTemplate "templates/default.html" indexCtx + >>= relativizeUrls - makeItem "" - >>= loadAndApplyTemplate "templates/tag.html" ctx - >>= loadAndApplyTemplate "templates/default.html" ctx - >>= relativizeUrls + create ["sitemap.xml"] $ do + route idRoute + compile $ do + posts <- recentFirst =<< loadAll "posts/*" + let sitemapCtx = + constField "baseUrl" "sanchayanmaity.gitlab.io" `mappend` + constField "title" "Sitemap" `mappend` + listField "posts" (postCtxWithTags tags) (return posts) `mappend` + (postCtxWithTags tags) + + makeItem "" + >>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx + >>= cleanIndexHtmls + + match "templates/*" $ compile templateBodyCompiler + + tagsRules tags $ \tag pattern -> do + let title = "Posts tagged \"" ++ tag ++ "\"" + route idRoute + compile $ do + posts <- recentFirst =<< loadAll pattern + let ctx = constField "title" title + `mappend` listField "posts" (postCtxWithTags tags) (return posts) + `mappend` defaultContext + + makeItem "" + >>= loadAndApplyTemplate "templates/tag.html" ctx + >>= loadAndApplyTemplate "templates/default.html" ctx + >>= relativizeUrls -------------------------------------------------------------------------------- config :: Configuration