summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/File.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-11 13:56:32 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-11 13:56:32 +0100
commitdae0258a62a714fb7fd9b47473bf259eb858f9f1 (patch)
treede6c4480cbd87ec9e8689dcdbefeee5618c8a3ef /src/Text/Hakyll/File.hs
parent7a765f29a2f5dcf753e5418c96a9c40ddb9112be (diff)
downloadhakyll-dae0258a62a714fb7fd9b47473bf259eb858f9f1.tar.gz
Readability++.
Diffstat (limited to 'src/Text/Hakyll/File.hs')
-rw-r--r--src/Text/Hakyll/File.hs23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs
index d8ee8db..0ed91d5 100644
--- a/src/Text/Hakyll/File.hs
+++ b/src/Text/Hakyll/File.hs
@@ -25,8 +25,9 @@ removeLeadingSeparator [] = []
removeLeadingSeparator path
| (head path') `elem` pathSeparators = (tail path')
| otherwise = path'
- where path' = if "$root" `isPrefixOf` path then drop 5 path
- else path
+ where
+ path' = if "$root" `isPrefixOf` path then drop 5 path
+ else path
-- | Convert a relative filepath to a filepath in the destination (_site).
toDestination :: FilePath -> FilePath
@@ -46,21 +47,24 @@ toURL path = if takeExtension path `elem` [".markdown", ".md", ".tex"]
toRoot :: FilePath -> FilePath
toRoot = emptyException . joinPath . map parent . splitPath
. takeDirectory . removeLeadingSeparator
- where parent = const ".."
- emptyException [] = "."
- emptyException x = x
+ where
+ parent = const ".."
+ emptyException [] = "."
+ emptyException x = x
-- | Swaps spaces for '-'.
removeSpaces :: FilePath -> FilePath
removeSpaces = map swap
- where swap ' ' = '-'
- swap x = x
+ where
+ swap ' ' = '-'
+ swap x = x
-- | Given a path to a file, try to make the path writable by making
-- all directories on the path.
makeDirectories :: FilePath -> IO ()
makeDirectories path = createDirectoryIfMissing True dir
- where dir = takeDirectory path
+ where
+ dir = takeDirectory path
-- | Get all contents of a directory. Note that files starting with a dot (.)
-- will be ignored.
@@ -75,7 +79,8 @@ getRecursiveContents topdir = do
then getRecursiveContents path
else return [path]
return (concat paths)
- where isProper = not . (== '.') . head
+ where
+ isProper = not . (== '.') . head
-- | A filter that takes all file names with a given extension. Prefix the
-- extension with a dot: