on master help sign in
Fixed some more issues.
1db2e00Jasper Van der Jeugt
src/Text/Hakyll/Page.hs+1−1
@@ -17,7 +17,7 @@ import Text.Pandoc
17type Page = M.Map String String
17type Page = M.Map String String
18
18
19addContext :: String -> String -> Page -> Page
19addContext :: String -> String -> Page -> Page
20−addContext key value = M.insert key value
20+addContext = M.insert
21
21
22getURL :: Page -> String
22getURL :: Page -> String
23getURL context = fromMaybe "404.html" $ M.lookup "url" context
23getURL context = fromMaybe "404.html" $ M.lookup "url" context
src/Text/Hakyll/Render.hs+3−1
@@ -32,7 +32,9 @@ renderPage templatePath page = do
32renderAndWrite :: FilePath -> Page -> IO ()
32renderAndWrite :: FilePath -> Page -> IO ()
33renderAndWrite templatePath page = do
33renderAndWrite templatePath page = do
34 rendered <- renderPage templatePath page
34 rendered <- renderPage templatePath page
35− writeFile (toDestination $ getURL rendered) (getBody rendered)
35+ let destination = toDestination $ getURL rendered
36+ touchDirectories destination
37+ writeFile destination (getBody rendered)
36
38
37static :: FilePath -> IO ()
39static :: FilePath -> IO ()
38static source = do
40static source = do
src/Text/Hakyll/Util.hs+2−1
@@ -14,7 +14,7 @@ touchDirectories path = createDirectoryIfMissing True dir
14getRecursiveContents :: FilePath -> IO [FilePath]
14getRecursiveContents :: FilePath -> IO [FilePath]
15getRecursiveContents topdir = do
15getRecursiveContents topdir = do
16 names <- getDirectoryContents topdir
16 names <- getDirectoryContents topdir
17− let properNames = filter (`notElem` [".", ".."]) names
17+ let properNames = filter isProper names
18 paths <- forM properNames $ \name -> do
18 paths <- forM properNames $ \name -> do
19 let path = topdir </> name
19 let path = topdir </> name
20 isDirectory <- doesDirectoryExist path
20 isDirectory <- doesDirectoryExist path
@@ -22,3 +22,4 @@ getRecursiveContents topdir = do
22 then getRecursiveContents path
22 then getRecursiveContents path
23 else return [path]
23 else return [path]
24 return (concat paths)
24 return (concat paths)
25+ where isProper = not . (== '.') . head