MakeDir
This commit is contained in:
parent
6ebc3f5e3a
commit
67bfa01b67
|
@ -14,6 +14,7 @@ module DependencyGenerator
|
||||||
, readTemplate
|
, readTemplate
|
||||||
, convertImage
|
, convertImage
|
||||||
, saveFile
|
, saveFile
|
||||||
|
, makeDir
|
||||||
, runPandoc
|
, runPandoc
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
@ -110,5 +111,8 @@ convertImage = runFunctionIO ConvertImage
|
||||||
saveFile :: Token (String, FilePath) -> DepGenM ()
|
saveFile :: Token (String, FilePath) -> DepGenM ()
|
||||||
saveFile = runFunctionIO SaveFile
|
saveFile = runFunctionIO SaveFile
|
||||||
|
|
||||||
|
makeDir :: Token FilePath -> DepGenM ()
|
||||||
|
makeDir = runFunctionIO MakeDir
|
||||||
|
|
||||||
runPandoc :: Token (FilePath, FilePath) -> DepGenM ()
|
runPandoc :: Token (FilePath, FilePath) -> DepGenM ()
|
||||||
runPandoc = runFunctionIO RunPandoc
|
runPandoc = runFunctionIO RunPandoc
|
||||||
|
|
|
@ -18,6 +18,9 @@ evalFunctionIO f x = case (f, x) of
|
||||||
(SaveFile, Tuple (String _, String _)) ->
|
(SaveFile, Tuple (String _, String _)) ->
|
||||||
pure $ Empty
|
pure $ Empty
|
||||||
|
|
||||||
|
(MakeDir, String _) ->
|
||||||
|
pure $ Empty
|
||||||
|
|
||||||
(RunPandoc, Tuple (String _, String _)) ->
|
(RunPandoc, Tuple (String _, String _)) ->
|
||||||
pure $ Empty
|
pure $ Empty
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,18 @@ handleRecipeDir _template dir = do
|
||||||
flip mapDepGenM_ (ZipToken imageFilenames convertedImageFilenames) $ \files -> do
|
flip mapDepGenM_ (ZipToken imageFilenames convertedImageFilenames) $ \files -> do
|
||||||
settings <- inject $ ResizeToWidth 800
|
settings <- inject $ ResizeToWidth 800
|
||||||
convertImage $ TupleToken files settings
|
convertImage $ TupleToken files settings
|
||||||
|
pure NoToken
|
||||||
|
|
||||||
generateSite :: DepGenM ()
|
generateSite :: DepGenM ()
|
||||||
generateSite = do
|
generateSite = do
|
||||||
|
outputDir <- inject "site"
|
||||||
|
makeDir outputDir
|
||||||
templateFilename <- inject "template.html"
|
templateFilename <- inject "template.html"
|
||||||
template <- readTemplate templateFilename
|
template <- readTemplate templateFilename
|
||||||
dir <- inject "retter"
|
dir <- inject "retter"
|
||||||
dirContents <- listDirectory dir
|
dirContents <- listDirectory dir
|
||||||
mapDepGenM_ (handleRecipeDir template) dirContents
|
mapDepGenM_ (handleRecipeDir template) dirContents
|
||||||
|
|
||||||
|
aboutFilenameIn <- inject "om.md"
|
||||||
|
aboutFilenameOut <- inject "om.html"
|
||||||
|
runPandoc $ TupleToken aboutFilenameIn aboutFilenameOut
|
||||||
|
|
|
@ -8,5 +8,6 @@ data FunctionIO = ListDirectory
|
||||||
| ReadTemplate
|
| ReadTemplate
|
||||||
| ConvertImage
|
| ConvertImage
|
||||||
| SaveFile
|
| SaveFile
|
||||||
|
| MakeDir
|
||||||
| RunPandoc
|
| RunPandoc
|
||||||
deriving (Show, Lift)
|
deriving (Show, Lift)
|
||||||
|
|
Loading…
Reference in New Issue