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