summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.