module Marihana.Build ( marihanaBuild ) where import System.Directory import System.FilePath.Posix directory = "./posts/" marihanaBuild :: IO () marihanaBuild = do list <- listDirectory directory marihanaMake (length list) marihanaMake :: Int -> IO () marihanaMake x = do list <- listDirectory directory if x <= 0 then return () else do marihanaMakeMain ((reverse list) !! (x - 1)) marihanaMake (x - 1) marihanaMakeMain :: String -> IO () marihanaMakeMain x = do print ((takeBaseName x) ++ ".html") copyFile "template/post.html" ("public/" ++ (takeBaseName x) ++ ".html")