summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-02-27 17:32:27 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-02-27 17:32:27 +0100
commitea1bb417268692a0e005ec331fb938eb445d01d1 (patch)
tree9f312d3078dbb721a8841b067799d3b3a9b91c8c /src/Text/Hakyll
parent959114275554dee0141d397d572a823d5b1906e3 (diff)
downloadhakyll-ea1bb417268692a0e005ec331fb938eb445d01d1.tar.gz
Readability improvements.
Diffstat (limited to 'src/Text/Hakyll')
-rw-r--r--src/Text/Hakyll/Context.hs15
-rw-r--r--src/Text/Hakyll/Regex.hs3
2 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Hakyll/Context.hs b/src/Text/Hakyll/Context.hs
index f84d161..69816b6 100644
--- a/src/Text/Hakyll/Context.hs
+++ b/src/Text/Hakyll/Context.hs
@@ -59,13 +59,14 @@ renderDate :: String -- ^ Key in which the rendered date should be placed.
renderDate key format defaultValue context = M.insert key value context
where
value = fromMaybe defaultValue pretty
- pretty = do filePath <- M.lookup "path" context
- let dateString = substituteRegex "^([0-9]*-[0-9]*-[0-9]*).*" "\\1"
- (takeFileName filePath)
- time <- parseTime defaultTimeLocale
- "%Y-%m-%d"
- dateString :: Maybe UTCTime
- return $ formatTime defaultTimeLocale format time
+ pretty = do
+ filePath <- M.lookup "path" context
+ let dateString = substituteRegex "^([0-9]*-[0-9]*-[0-9]*).*" "\\1"
+ (takeFileName filePath)
+ time <- parseTime defaultTimeLocale
+ "%Y-%m-%d"
+ dateString :: Maybe UTCTime
+ return $ formatTime defaultTimeLocale format time
-- | Change the extension of a file. This is only needed when you want to
-- render, for example, mardown to @.php@ files instead of @.html@ files.
diff --git a/src/Text/Hakyll/Regex.hs b/src/Text/Hakyll/Regex.hs
index 8706f99..96db2d2 100644
--- a/src/Text/Hakyll/Regex.hs
+++ b/src/Text/Hakyll/Regex.hs
@@ -41,7 +41,8 @@ subRegex regexp inp replacement =
in case matchRegexAll regexp inp of
Nothing -> inp
Just (lead, match', trail, groups) ->
- lead ++ lookup' match' replacement groups ++ subRegex regexp trail replacement
+ lead ++ lookup' match' replacement groups
+ ++ subRegex regexp trail replacement
-- | Splits a string based on a regular expression. The regular expression
-- should identify one delimiter.