Also build every recipe html page
This commit is contained in:
parent
daacf2e6fa
commit
4a0ea4d5ef
|
@ -3,14 +3,23 @@ module SiteGenerator (generateSite) where
|
||||||
import Types
|
import Types
|
||||||
import DependencyGenerator
|
import DependencyGenerator
|
||||||
|
|
||||||
handleRecipeDir :: Token Template -> Token FilePath -> DepGenM ()
|
handleRecipeDir :: Token FilePath -> Token Template -> Token FilePath -> DepGenM ()
|
||||||
handleRecipeDir _template dir = do
|
handleRecipeDir outputDir template dir = do
|
||||||
dirContents <- listDirectory dir
|
dirContents <- listDirectory dir
|
||||||
imageFilenames <- filterDepGenM isImageFilename dirContents
|
imageFilenames <- filterDepGenM isImageFilename dirContents
|
||||||
convertedImageFilenames <- mapDepGenM convertedImageFilename imageFilenames
|
convertedImageFilenames <- mapDepGenM convertedImageFilename imageFilenames
|
||||||
flip mapDepGenM_ (ZipToken imageFilenames convertedImageFilenames) $ \files -> do
|
flip mapDepGenM_ (ZipToken imageFilenames convertedImageFilenames) $ \files -> do
|
||||||
settings <- inject $ ResizeToWidth 800
|
settings <- inject $ ResizeToWidth 800
|
||||||
convertImage $ TupleToken files settings
|
convertImage $ TupleToken files settings
|
||||||
|
recipeFilenameIn <- inject "ret.md"
|
||||||
|
recipePathIn <- joinPaths $ TupleToken dir recipeFilenameIn
|
||||||
|
recipeDirOut <- joinPaths $ TupleToken outputDir dir
|
||||||
|
makeDir recipeDirOut
|
||||||
|
recipeFilenameOut <- inject "index.html"
|
||||||
|
recipePathOut <- joinPaths $ TupleToken recipeDirOut recipeFilenameOut
|
||||||
|
htmlBody <- runPandoc recipePathIn
|
||||||
|
html <- applyTemplate $ TupleToken template htmlBody
|
||||||
|
saveFile $ TupleToken html recipePathOut
|
||||||
|
|
||||||
generateSite :: DepGenM ()
|
generateSite :: DepGenM ()
|
||||||
generateSite = do
|
generateSite = do
|
||||||
|
@ -20,11 +29,11 @@ generateSite = do
|
||||||
template <- readTemplate templateFilename
|
template <- readTemplate templateFilename
|
||||||
dir <- inject "retter"
|
dir <- inject "retter"
|
||||||
dirContents <- listDirectory dir
|
dirContents <- listDirectory dir
|
||||||
mapDepGenM_ (handleRecipeDir template) dirContents
|
mapDepGenM_ (handleRecipeDir outputDir template) dirContents
|
||||||
|
|
||||||
aboutPathIn <- inject "om.md"
|
aboutPathIn <- inject "om.md"
|
||||||
aboutHtmlBody <- runPandoc aboutPathIn
|
|
||||||
aboutHtml <- applyTemplate $ TupleToken template aboutHtmlBody
|
|
||||||
aboutFilenameOut <- inject "om.html"
|
aboutFilenameOut <- inject "om.html"
|
||||||
aboutPathOut <- joinPaths $ TupleToken outputDir aboutFilenameOut
|
aboutPathOut <- joinPaths $ TupleToken outputDir aboutFilenameOut
|
||||||
|
aboutHtmlBody <- runPandoc aboutPathIn
|
||||||
|
aboutHtml <- applyTemplate $ TupleToken template aboutHtmlBody
|
||||||
saveFile $ TupleToken aboutHtml aboutPathOut
|
saveFile $ TupleToken aboutHtml aboutPathOut
|
||||||
|
|
Loading…
Reference in New Issue