Use correct recipe-specific output dir

This commit is contained in:
Niels G. W. Serup 2024-09-26 00:09:48 +02:00
parent e770a350d6
commit bd6ede1df9
No known key found for this signature in database
GPG Key ID: 38EEEBCE67324F19
1 changed files with 4 additions and 4 deletions

View File

@ -11,19 +11,19 @@ thumbnailImagePath outputDir filename = do
handleRecipeDir :: Token FilePath -> Token Template -> Token FilePath -> Token FilePath -> DepGenM ()
handleRecipeDir outputDir template indexName dir = do
recipeDirOut <- joinPaths (outputDir, dir)
makeDir recipeDirOut
dirContents <- listDirectory dir
exts <- unzipSndDepGenM (mapDepGenM fileComponents dirContents)
areImageFilenames <- mapDepGenM isImageExtension exts
imageFilenames <- filterDepGenM areImageFilenames dirContents
imagePaths <- mapDepGenM (curry joinPaths dir) imageFilenames
imagePathsOut <- mapDepGenM (curry joinPaths outputDir) imageFilenames
imagePathsOut <- mapDepGenM (curry joinPaths recipeDirOut) imageFilenames
mapDepGenM_ copyFile' (ZipToken (imagePaths, imagePathsOut))
thumbnailImagePaths <- mapDepGenM (thumbnailImagePath outputDir) imageFilenames
thumbnailImagePaths <- mapDepGenM (thumbnailImagePath recipeDirOut) imageFilenames
mapDepGenM_
(\files -> convertImage (files, inject $ ResizeToWidth 800))
(ZipToken (imagePaths, thumbnailImagePaths))
recipeDirOut <- joinPaths (outputDir, dir)
makeDir recipeDirOut
htmlBody <- runPandoc (joinPaths (dir, inject "ret.md"))
html <- applyTemplate (template, htmlBody)
saveFile (html, joinPaths (recipeDirOut, indexName))