on master help sign in
Export getModificationTime
commit0bfa763dc6d541ccf21da9456643067b3d96872f authorJasper Van der Jeugt <m@jaspervdj.be> dateSat 24 Oct 2015, 11:42 (11 years ago) parent8dec0a5
3 files changed+18−3
hakyll.cabal+1−1 src/Hakyll/Web/Template/Context.hs+13−2 web/releases.markdown+4
hakyll.cabal+1−1
@@ -1,5 +1,5 @@
11Name: hakyll
2−Version: 4.7.3.1
2+Version: 4.7.4.0
33
44Synopsis: A static website compiler library
55Description:
src/Hakyll/Web/Template/Context.hs+13−2
@@ -21,6 +21,7 @@ module Hakyll.Web.Template.Context
2121 , dateField
2222 , dateFieldWith
2323 , getItemUTC
24+ , getItemModificationTime
2425 , modificationTimeField
2526 , modificationTimeFieldWith
2627 , teaserField
@@ -295,6 +296,17 @@ getItemUTC locale id' = do
295296 ]
296297
297298
299+--------------------------------------------------------------------------------
300+-- | Get the time on which the actual file was last modified. This only works if
301+-- there actually is an underlying file, of couse.
302+getItemModificationTime
303+ :: Identifier
304+ -> Compiler UTCTime
305+getItemModificationTime identifier = do
306+ provider <- compilerProvider <$> compilerAsk
307+ return $ resourceModificationTime provider identifier
308+
309+
298310--------------------------------------------------------------------------------
299311modificationTimeField :: String -- ^ Key
300312 -> String -- ^ Format
@@ -308,8 +320,7 @@ modificationTimeFieldWith :: TimeLocale -- ^ Time output locale
308320 -> String -- ^ Format
309321 -> Context a -- ^ Resulting context
310322modificationTimeFieldWith locale key fmt = field key $ \i -> do
311− provider <- compilerProvider <$> compilerAsk
312− let mtime = resourceModificationTime provider $ itemIdentifier i
323+ mtime <- getItemModificationTime $ itemIdentifier i
313324 return $ formatTime locale fmt mtime
314325
315326
web/releases.markdown+4
@@ -4,6 +4,10 @@ title: Releases
44
55# Releases
66
7+## Hakyll 4.7.4.0
8+
9+- Expose `getItemModificationTime`
10+
711## Hakyll 4.7.3.1
812
913- Bump pandoc-citeproc dependency to 0.8