23 lines
781 B
Haskell
23 lines
781 B
Haskell
|
module SiteGenerator (generateSite) where
|
||
|
|
||
|
import Types
|
||
|
import DependencyGenerator
|
||
|
|
||
|
handleRecipeDir :: Token Template -> Token FilePath -> DepGenM ()
|
||
|
handleRecipeDir _template dir = do
|
||
|
dirContents <- listDirectory dir
|
||
|
imageFilenames <- filterDepGenM isImageFilename dirContents
|
||
|
convertedImageFilenames <- mapDepGenM convertedImageFilename imageFilenames
|
||
|
flip mapDepGenM_ (ZipToken imageFilenames convertedImageFilenames) $ \files -> do
|
||
|
settings <- inject $ ResizeToWidth 800
|
||
|
convertImage $ TupleToken files settings
|
||
|
|
||
|
generateSite :: DepGenM ()
|
||
|
generateSite = do
|
||
|
templateFilename <- inject "template.html"
|
||
|
template <- readTemplate templateFilename
|
||
|
dir <- inject "retter"
|
||
|
dirContents <- listDirectory dir
|
||
|
mapDepGenM_ (handleRecipeDir template) dirContents
|
||
|
|