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 <- lowerString $ untupleSndDepGenM $ fileComponents filename
|
||||||
ext `elemOf` exts
|
ext `elemOf` exts
|
||||||
|
|
||||||
handleRecipeDir :: Token FilePath -> Token FilePath -> Token Template -> Token FilePath -> Token FilePath -> DepGenM ()
|
handleRecipeDir :: Token FilePath -> Token Template -> Token FilePath -> Token FilePath -> DepGenM ()
|
||||||
handleRecipeDir inputDir outputDir template indexName name = do
|
handleRecipeDir outputDir template indexName dir = do
|
||||||
dir <- joinPaths inputDir name
|
recipeDirOut <- joinPaths outputDir dir
|
||||||
recipeDirOut <- joinPaths outputDir name
|
|
||||||
makeDir recipeDirOut
|
makeDir recipeDirOut
|
||||||
dirContents <- listDirectory dir
|
dirContents <- listDirectory dir
|
||||||
areImageFilenames <- mapDepGenM (hasExtension $ inject ["jpg"]) dirContents
|
areImageFilenames <- mapDepGenM (hasExtension $ inject ["jpg"]) dirContents
|
||||||
|
@ -65,15 +64,14 @@ generateSite = do
|
||||||
outputDir <- inject "site"
|
outputDir <- inject "site"
|
||||||
makeDir outputDir
|
makeDir outputDir
|
||||||
recipesDir <- inject "retter"
|
recipesDir <- inject "retter"
|
||||||
outputRecipesDir <- joinPaths outputDir recipesDir
|
makeDir $ joinPaths outputDir recipesDir
|
||||||
makeDir outputRecipesDir
|
|
||||||
template <- makeTemplate (readTextFile (inject "template.html")) (inject "CONTENT")
|
template <- makeTemplate (readTextFile (inject "template.html")) (inject "CONTENT")
|
||||||
indexName <- inject "index.html"
|
indexName <- inject "index.html"
|
||||||
dirNames <- listDirectory recipesDir
|
dirNames <- listDirectory recipesDir
|
||||||
dirPaths <- mapDepGenM (joinPaths recipesDir) dirNames
|
dirPaths <- mapDepGenM (joinPaths recipesDir) dirNames
|
||||||
dirPathsAreSubdirs <- mapDepGenM isDirectory dirPaths
|
dirPathsAreSubdirs <- mapDepGenM isDirectory dirPaths
|
||||||
dirNames' <- filterDepGenM dirPathsAreSubdirs dirNames
|
dirPaths' <- filterDepGenM dirPathsAreSubdirs dirPaths
|
||||||
mapDepGenM_ (handleRecipeDir recipesDir outputRecipesDir template indexName) dirNames'
|
mapDepGenM_ (handleRecipeDir outputDir template indexName) dirPaths'
|
||||||
html <- applyTemplate template $ runPandoc $ readTextFile $ inject "om.md"
|
html <- applyTemplate template $ runPandoc $ readTextFile $ inject "om.md"
|
||||||
aboutDir <- joinPaths outputDir $ inject "om"
|
aboutDir <- joinPaths outputDir $ inject "om"
|
||||||
makeDir aboutDir
|
makeDir aboutDir
|
||||||
|
|
Loading…
Reference in New Issue