This commit is contained in:
Yann Esposito (Yogsototh) 2020-06-22 12:27:45 +02:00
parent b81339a51e
commit 5359765bf5
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
3 changed files with 22 additions and 15 deletions

2
.gitignore vendored
View file

@ -1,4 +1,6 @@
_cache/ _cache/
_site/
_optim/
src/archive.org src/archive.org
.direnv/ .direnv/
_shake/ _shake/

View file

@ -80,25 +80,43 @@ sortByPostDate :: [BlogPost] -> [BlogPost]
sortByPostDate = sortByPostDate =
sortBy (\b a -> compare (Down (postDate a)) (Down (postDate b))) sortBy (\b a -> compare (Down (postDate a)) (Down (postDate b)))
build = (</>) siteDir
buildRules :: Rules () buildRules :: Rules ()
buildRules = do buildRules = do
let build = (</>) siteDir
cleanRule cleanRule
allRule
getPost <- mkGetPost getPost <- mkGetPost
getPosts <- mkGetPosts getPost getPosts <- mkGetPosts getPost
let cssDeps = map (siteDir </>) <$> getDirectoryFiles "" ["src/css/*.css"] let cssDeps = map (siteDir </>) <$> getDirectoryFiles "" ["src/css/*.css"]
build "index.html" %> \out -> do build "articles.html" %> \out -> do
css <- cssDeps css <- cssDeps
posts <- getPosts () posts <- getPosts ()
need $ css <> map postUrl (sortByPostDate posts) need $ css <> map postUrl (sortByPostDate posts)
let titles = T.unpack $ T.intercalate "\n" $ map postTitle posts let titles = T.unpack $ T.intercalate "\n" $ map postTitle posts
writeFile' out titles 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 -- build "//*.html" %> \out -> do
-- css <- cssDeps -- css <- cssDeps
-- let orgfile = dropDirectory1 out -- let orgfile = dropDirectory1 out
-- post <- getPost orgfile -- post <- getPost orgfile
build "src/css/*.css" %> \out -> copyFile' (dropDirectory1 out) out build "src/css/*.css" %> \out -> copyFile' (dropDirectory1 out) out
allRule :: Rules ()
allRule =
phony "all" $
need (map build [ "index.html"
, "articles.html"])
cleanRule :: Rules () cleanRule :: Rules ()
cleanRule = cleanRule =
phony "clean" $ do phony "clean" $ do

View file

@ -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