diff --git a/byg/src/SiteGenerator.hs b/byg/src/SiteGenerator.hs index 64cda74..0a60254 100644 --- a/byg/src/SiteGenerator.hs +++ b/byg/src/SiteGenerator.hs @@ -29,10 +29,9 @@ hasExtension exts filename = do ext <- lowerString $ untupleSndDepGenM $ fileComponents filename ext `elemOf` exts -handleRecipeDir :: Token FilePath -> Token FilePath -> Token Template -> Token FilePath -> Token FilePath -> DepGenM () -handleRecipeDir inputDir outputDir template indexName name = do - dir <- joinPaths inputDir name - recipeDirOut <- joinPaths outputDir name +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 areImageFilenames <- mapDepGenM (hasExtension $ inject ["jpg"]) dirContents @@ -65,15 +64,14 @@ generateSite = do outputDir <- inject "site" makeDir outputDir recipesDir <- inject "retter" - outputRecipesDir <- joinPaths outputDir recipesDir - makeDir outputRecipesDir + makeDir $ joinPaths outputDir recipesDir template <- makeTemplate (readTextFile (inject "template.html")) (inject "CONTENT") indexName <- inject "index.html" dirNames <- listDirectory recipesDir dirPaths <- mapDepGenM (joinPaths recipesDir) dirNames dirPathsAreSubdirs <- mapDepGenM isDirectory dirPaths - dirNames' <- filterDepGenM dirPathsAreSubdirs dirNames - mapDepGenM_ (handleRecipeDir recipesDir outputRecipesDir template indexName) dirNames' + dirPaths' <- filterDepGenM dirPathsAreSubdirs dirPaths + mapDepGenM_ (handleRecipeDir outputDir template indexName) dirPaths' html <- applyTemplate template $ runPandoc $ readTextFile $ inject "om.md" aboutDir <- joinPaths outputDir $ inject "om" makeDir aboutDir