shake: cleanup

This commit is contained in:
Simon Michael 2019-02-09 17:49:28 -08:00
parent d79bd77feb
commit aeb7d58c31

View File

@ -38,7 +38,6 @@ Shake wishes:
just one shake import just one shake import
wildcards in phony rules wildcards in phony rules
multiple individually accessible wildcards multiple individually accessible wildcards
not having to write :: Action ExitCode after a non-final cmd
-} -}
{-# LANGUAGE MultiWayIf #-} {-# LANGUAGE MultiWayIf #-}
@ -344,11 +343,11 @@ main = do
need webmanuals need webmanuals
liftIO $ writeFile webmancombined "\\$toc\\$" -- # Big Manual\n\n -- TOC style is better without main heading, liftIO $ writeFile webmancombined "\\$toc\\$" -- # Big Manual\n\n -- TOC style is better without main heading,
forM_ webmanuals $ \f -> do -- site/hledger.md, site/journal.md forM_ webmanuals $ \f -> do -- site/hledger.md, site/journal.md
cmd Shell ("printf '\\n\\n' >>") webmancombined :: Action ExitCode cmd_ Shell ("printf '\\n\\n' >>") webmancombined
cmd Shell pandoc f towebmd cmd_ Shell pandoc f towebmd
"--lua-filter tools/pandoc-drop-toc.lua" "--lua-filter tools/pandoc-drop-toc.lua"
"--lua-filter tools/pandoc-demote-headers.lua" "--lua-filter tools/pandoc-demote-headers.lua"
">>" webmancombined :: Action ExitCode ">>" webmancombined
-- Copy some extra markdown files from the main repo into the site -- Copy some extra markdown files from the main repo into the site
-- TODO adding table of contents placeholders -- TODO adding table of contents placeholders
@ -357,7 +356,11 @@ main = do
-- WEBSITE HTML & ASSETS -- WEBSITE HTML & ASSETS
phony "website" $ need [ "webassets" , "mainpages", "wikipages" ] phony "website" $ need [
"webassets"
,"mainpages"
,"wikipages"
]
-- copy all static asset files (files with certain extensions -- copy all static asset files (files with certain extensions
-- found under sites, plus one or two more) to sites/_site/ -- found under sites, plus one or two more) to sites/_site/
@ -633,12 +636,12 @@ main = do
"site/doc/*/.snapshot" %> \out -> do "site/doc/*/.snapshot" %> \out -> do
need $ webmancombined : webmanuals need $ webmancombined : webmanuals
let snapshot = takeDirectory out let snapshot = takeDirectory out
cmd Shell "mkdir -p" snapshot :: Action ExitCode cmd_ Shell "mkdir -p" snapshot
forM_ webmanuals $ \f -> do -- site/hledger.md, site/journal.md forM_ webmanuals $ \f -> -- site/hledger.md, site/journal.md
cmd Shell "cp" f (snapshot </> takeFileName f) :: Action ExitCode cmd_ Shell "cp" f (snapshot </> takeFileName f)
cmd Shell "cp" "site/manual.md" snapshot :: Action ExitCode cmd_ Shell "cp" "site/manual.md" snapshot
cmd Shell "cp -r site/images" snapshot :: Action ExitCode cmd_ Shell "cp -r site/images" snapshot
cmd Shell "touch" out -- :: Action ExitCode cmd_ Shell "touch" out
-- Cleanup. -- Cleanup.