module Main where import Control.Exception import Data.Either import Data.List import Data.Maybe import System.Directory --import System.FilePath import System.Environment (getArgs) import System.Process (readProcess) import Paths_heckle (version) import Data.Version (showVersion) import Data.Monoid ((<>)) import Heckle import Files buildSite :: IO () buildSite = do putStrLn "Reading directory and turning into native posts" postsToBeCreated <- mapM fileToPost =<< getDirectoryContents "posts" let posts = reverse . sort . rights $ postsToBeCreated putStrLn $ "Number of posts found: " ++ show (length posts) putStrLn "Writing markdown files into template HTML" template <- readFile "template.html.hkl" sequence $ mapMaybe (writeHTML template) posts putStrLn "Creating HTML