-
Notifications
You must be signed in to change notification settings - Fork 114
/
Build.hs
38 lines (32 loc) · 1.09 KB
/
Build.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import Prelude
import Development.Shake
( cmd,
shakeArgs,
shakeOptions,
getDirectoryFiles,
(%>),
need,
phony,
putInfo,
removeFilesAfter,
want )
import Development.Shake.FilePath ( (-<.>), (</>), dropDirectory1 )
main :: IO ()
main = shakeArgs shakeOptions $ do
want ["output/scheme.html"]
want ["wiki"]
phony "wiki" $ do
files <- fmap ("docs/" </>) <$> getDirectoryFiles "docs" ["*.md"]
let targets = ["output" </> (f -<.> "wiki") | f <- files]
need targets
phony "clean" $ do
putInfo "Cleaning files in output"
removeFilesAfter "output" ["//*"]
"output/scheme.html" %> \out -> do
need ["resources/page.tmpl"]
files <- fmap ("docs/" </>) <$> getDirectoryFiles "docs" ["*.md"]
need files
cmd ("pandoc" :: String) files ["-o" :: String] out (["--template", "resources/page.tmpl"] :: [String])
"output//*.wiki" %> \out -> do
let src = dropDirectory1 $ out -<.> "md"
cmd ("pandoc" :: String) src ("-o" :: String) out (["-t", "mediawiki"] :: [String])