Go a more direct route with the recipes dirs
This commit is contained in:
parent
9240d66c15
commit
90a968ea7d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue