From 5359765bf54640e2f89c5b99ecddeead15dc5cec Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Mon, 22 Jun 2020 12:27:45 +0200 Subject: [PATCH] updated --- .gitignore | 2 ++ Shakefile.hs | 22 ++++++++++++++++++++-- _site/index.html | 13 ------------- 3 files changed, 22 insertions(+), 15 deletions(-) delete mode 100644 _site/index.html diff --git a/.gitignore b/.gitignore index e3771aa..bb5e6a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ _cache/ +_site/ +_optim/ src/archive.org .direnv/ _shake/ diff --git a/Shakefile.hs b/Shakefile.hs index 9e15316..837aad1 100644 --- a/Shakefile.hs +++ b/Shakefile.hs @@ -80,25 +80,43 @@ sortByPostDate :: [BlogPost] -> [BlogPost] sortByPostDate = sortBy (\b a -> compare (Down (postDate a)) (Down (postDate b))) + +build = () siteDir + buildRules :: Rules () buildRules = do - let build = () siteDir cleanRule + allRule getPost <- mkGetPost getPosts <- mkGetPosts getPost let cssDeps = map (siteDir ) <$> getDirectoryFiles "" ["src/css/*.css"] - build "index.html" %> \out -> do + build "articles.html" %> \out -> do css <- cssDeps posts <- getPosts () need $ css <> map postUrl (sortByPostDate posts) let titles = T.unpack $ T.intercalate "\n" $ map postTitle posts writeFile' out titles + build "index.html" %> \out -> do + css <- cssDeps + need $ css <> ["src/index.org"] + bp <- getPost "src/index.org" + eitherHtml <- liftIO $ Pandoc.runIO $ Writers.writeHtml5String def (postBody bp) + case eitherHtml of + Left _ -> fail "BAD" + Right htmlFile -> writeFile' out (T.unpack htmlFile) -- build "//*.html" %> \out -> do -- css <- cssDeps -- let orgfile = dropDirectory1 out -- post <- getPost orgfile build "src/css/*.css" %> \out -> copyFile' (dropDirectory1 out) out + +allRule :: Rules () +allRule = + phony "all" $ + need (map build [ "index.html" + , "articles.html"]) + cleanRule :: Rules () cleanRule = phony "clean" $ do diff --git a/_site/index.html b/_site/index.html deleted file mode 100644 index 255da53..0000000 --- a/_site/index.html +++ /dev/null @@ -1,13 +0,0 @@ -New Blog -Troll 2 -Autoload Script by project -How I Internet -RSS Generation -Modern IRC -Catalina iTerm Theme switch -Further Blog Engine change -Optimize the size of no js websites -Learn Haskell Now! -Add links to code block during orgmode export -Solaryzed: A Generalisation of Solarized -How to choose your tools \ No newline at end of file