diff --git a/byg/src/SiteGenerator.hs b/byg/src/SiteGenerator.hs index 719f949..af364d1 100644 --- a/byg/src/SiteGenerator.hs +++ b/byg/src/SiteGenerator.hs @@ -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))