on master help sign in
Fixed some more issues.
commit1db2e00bbb813795cf858f69c21fa6c6837091a0 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateWed 2 Dec 2009, 16:23 (17 years ago) parentf716440
3 files changed+6−3
src/Text/Hakyll/Page.hs+1−1 src/Text/Hakyll/Render.hs+3−1 src/Text/Hakyll/Util.hs+2−1
src/Text/Hakyll/Page.hs+1−1
@@ -17,7 +17,7 @@ import Text.Pandoc
1717type Page = M.Map String String
1818
1919addContext :: String -> String -> Page -> Page
20−addContext key value = M.insert key value
20+addContext = M.insert
2121
2222getURL :: Page -> String
2323getURL context = fromMaybe "404.html" $ M.lookup "url" context
src/Text/Hakyll/Render.hs+3−1
@@ -32,7 +32,9 @@ renderPage templatePath page = do
3232renderAndWrite :: FilePath -> Page -> IO ()
3333renderAndWrite templatePath page = do
3434 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)
3638
3739static :: FilePath -> IO ()
3840static source = do
src/Text/Hakyll/Util.hs+2−1
@@ -14,7 +14,7 @@ touchDirectories path = createDirectoryIfMissing True dir
1414getRecursiveContents :: FilePath -> IO [FilePath]
1515getRecursiveContents topdir = do
1616 names <- getDirectoryContents topdir
17− let properNames = filter (`notElem` [".", ".."]) names
17+ let properNames = filter isProper names
1818 paths <- forM properNames $ \name -> do
1919 let path = topdir </> name
2020 isDirectory <- doesDirectoryExist path
@@ -22,3 +22,4 @@ getRecursiveContents topdir = do
2222 then getRecursiveContents path
2323 else return [path]
2424 return (concat paths)
25+ where isProper = not . (== '.') . head