Neil Mitchell help https://github.com/ndmitchell/shake/issues/767
This commit is contained in:
parent
0a1aef7425
commit
c34fa83504
13
Shakefile.hs
13
Shakefile.hs
|
@ -107,12 +107,11 @@ genAllDeps patterns = do
|
||||||
buildRules :: Rules ()
|
buildRules :: Rules ()
|
||||||
buildRules = do
|
buildRules = do
|
||||||
cleanRule
|
cleanRule
|
||||||
-- build "//*" %> copy
|
|
||||||
allRule
|
allRule
|
||||||
getPost <- mkGetPost
|
getPost <- mkGetPost
|
||||||
getPosts <- mkGetPosts getPost
|
getPosts <- mkGetPosts getPost
|
||||||
getTemplate <- mkGetTemplate
|
getTemplate <- mkGetTemplate
|
||||||
build "//*" %> \out -> do
|
build "**" %> \out -> do
|
||||||
let asset = dropDirectory1 out
|
let asset = dropDirectory1 out
|
||||||
case (takeExtension asset) of
|
case (takeExtension asset) of
|
||||||
".html" -> do
|
".html" -> do
|
||||||
|
@ -231,13 +230,13 @@ genAsciiAction getPost out = do
|
||||||
|
|
||||||
allHtmlAction :: Action ()
|
allHtmlAction :: Action ()
|
||||||
allHtmlAction = do
|
allHtmlAction = do
|
||||||
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
allOrgFiles <- getDirectoryFiles srcDir ["**.org"]
|
||||||
let allHtmlFiles = map (-<.> "html") allOrgFiles
|
let allHtmlFiles = map (-<.> "html") allOrgFiles
|
||||||
need (map build allHtmlFiles)
|
need (map build allHtmlFiles)
|
||||||
|
|
||||||
allAsciiAction :: Action ()
|
allAsciiAction :: Action ()
|
||||||
allAsciiAction = do
|
allAsciiAction = do
|
||||||
allOrgFiles <- getDirectoryFiles srcDir ["//*.org"]
|
allOrgFiles <- getDirectoryFiles srcDir ["**.org"]
|
||||||
let allAsciiFiles = map (-<.> "txt") allOrgFiles
|
let allAsciiFiles = map (-<.> "txt") allOrgFiles
|
||||||
need (map build allAsciiFiles)
|
need (map build allAsciiFiles)
|
||||||
|
|
||||||
|
@ -263,7 +262,7 @@ compressImage img = do
|
||||||
allRule :: Rules ()
|
allRule :: Rules ()
|
||||||
allRule =
|
allRule =
|
||||||
phony "all" $ do
|
phony "all" $ do
|
||||||
allAssets <- filter (/= ".DS_Store") <$> getDirectoryFiles srcDir ["//*.*"]
|
allAssets <- filter (/= ".DS_Store") <$> getDirectoryFiles srcDir ["**"]
|
||||||
need (map build $ allAssets <> ["archive.html"])
|
need (map build $ allAssets <> ["archive.html"])
|
||||||
allHtmlAction
|
allHtmlAction
|
||||||
allAsciiAction
|
allAsciiAction
|
||||||
|
@ -272,7 +271,7 @@ cleanRule :: Rules ()
|
||||||
cleanRule =
|
cleanRule =
|
||||||
phony "clean" $ do
|
phony "clean" $ do
|
||||||
putInfo "Cleaning files in _site and _optim"
|
putInfo "Cleaning files in _site and _optim"
|
||||||
forM_ [siteDir,optimDir] $ flip removeFilesAfter ["//*"]
|
forM_ [siteDir,optimDir] $ flip removeFilesAfter ["**"]
|
||||||
|
|
||||||
mkGetTemplate :: Rules (FilePath -> Action Template)
|
mkGetTemplate :: Rules (FilePath -> Action Template)
|
||||||
mkGetTemplate = newCache $ \path -> do
|
mkGetTemplate = newCache $ \path -> do
|
||||||
|
@ -302,4 +301,4 @@ mkGetPost = newCache $ \path -> do
|
||||||
|
|
||||||
mkGetPosts :: (FilePath -> Action b) -> Rules (() -> Action [b])
|
mkGetPosts :: (FilePath -> Action b) -> Rules (() -> Action [b])
|
||||||
mkGetPosts getPost =
|
mkGetPosts getPost =
|
||||||
newCache $ \() -> mapM getPost =<< getDirectoryFiles "" ["src/posts//*.org"]
|
newCache $ \() -> mapM getPost =<< getDirectoryFiles "" ["src/posts/**.org"]
|
||||||
|
|
|
@ -26,5 +26,7 @@ pkgs.mkShell {
|
||||||
git
|
git
|
||||||
direnv
|
direnv
|
||||||
haskellPackages.shake
|
haskellPackages.shake
|
||||||
|
# for emacs dev
|
||||||
|
ripgrep
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,9 +344,9 @@ After the rule.
|
||||||
|
|
||||||
an image:
|
an image:
|
||||||
|
|
||||||
|
#+ATTR_HTML: The Experiment
|
||||||
#+CAPTION: Testing include an image
|
#+CAPTION: Testing include an image
|
||||||
#+NAME: fig:test-image
|
#+NAME: fig:test-image
|
||||||
#+ATTR_HTML: The Experiment
|
|
||||||
[[../img/a.png]]
|
[[../img/a.png]]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ And this week-end, in the morning I read those:
|
||||||
- [[https://news.ycombinator.com/item?id=23107123][Making Emacs popular again]]
|
- [[https://news.ycombinator.com/item?id=23107123][Making Emacs popular again]]
|
||||||
- [[https://news.ycombinator.com/item?id=23092904][Github Codespace]]
|
- [[https://news.ycombinator.com/item?id=23092904][Github Codespace]]
|
||||||
|
|
||||||
#+DOWNLOADED: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.g7OSuCGH0u7OIUA9vdxlTAEsCo%26pid%3DApi&f=1 @ 2020-05-09 12:49:34
|
|
||||||
#+ATTR_HTML: :alt Midsommar Welcome
|
#+ATTR_HTML: :alt Midsommar Welcome
|
||||||
|
#+DOWNLOADED: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.g7OSuCGH0u7OIUA9vdxlTAEsCo%26pid%3DApi&f=1 @ 2020-05-09 12:49:34
|
||||||
[[file:2020-05-09_12-49-34_.jpeg]]
|
[[file:2020-05-09_12-49-34_.jpeg]]
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ For the single developers and open source developers this offer:
|
||||||
|
|
||||||
But the price to pay is hidden.
|
But the price to pay is hidden.
|
||||||
|
|
||||||
#+DOWNLOADED: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.FrCRrhENMjdfD4pUcAwKEgHaEK%26pid%3DApi&f=1 @ 2020-05-09 12:48:31
|
|
||||||
#+ATTR_HTML: :alt Midsommar Cry
|
#+ATTR_HTML: :alt Midsommar Cry
|
||||||
|
#+DOWNLOADED: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.FrCRrhENMjdfD4pUcAwKEgHaEK%26pid%3DApi&f=1 @ 2020-05-09 12:48:31
|
||||||
[[file:2020-05-09_12-48-31_.jpeg]]
|
[[file:2020-05-09_12-48-31_.jpeg]]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue