diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2016-04-06 14:26:46 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2016-04-06 14:26:46 +0200 |
commit | e81468e0f64fdbe05794d5f8ccaebc00ee474ee2 (patch) | |
tree | 882c422a312ed3e6eb8eaacfcc9c292a09296845 /src/Hakyll/Web/Template/Context.hs | |
parent | 3f3e09672d3d279bc5cbaa8b3ac7508abc98aa2d (diff) | |
download | hakyll-e81468e0f64fdbe05794d5f8ccaebc00ee474ee2.tar.gz |
Initial YAML support
See #225
Diffstat (limited to 'src/Hakyll/Web/Template/Context.hs')
-rw-r--r-- | src/Hakyll/Web/Template/Context.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs index 6879187..efe808a 100644 --- a/src/Hakyll/Web/Template/Context.hs +++ b/src/Hakyll/Web/Template/Context.hs @@ -31,18 +31,13 @@ module Hakyll.Web.Template.Context -------------------------------------------------------------------------------- -import Control.Applicative (Alternative (..), pure, (<$>)) +import Control.Applicative (Alternative (..)) import Control.Monad (msum) import Data.List (intercalate) -import qualified Data.Map as M -import Data.Monoid (Monoid (..)) import Data.Time.Clock (UTCTime (..)) import Data.Time.Format (formatTime) import qualified Data.Time.Format as TF import Data.Time.Locale.Compat (TimeLocale, defaultTimeLocale) -import System.FilePath (splitDirectories, takeBaseName) - --------------------------------------------------------------------------------- import Hakyll.Core.Compiler import Hakyll.Core.Compiler.Internal import Hakyll.Core.Identifier @@ -51,6 +46,7 @@ import Hakyll.Core.Metadata import Hakyll.Core.Provider import Hakyll.Core.Util.String (needlePrefix, splitAll) import Hakyll.Web.Html +import System.FilePath (splitDirectories, takeBaseName) -------------------------------------------------------------------------------- @@ -274,7 +270,7 @@ getItemUTC :: MonadMetadata m -> m UTCTime -- ^ Parsed UTCTime getItemUTC locale id' = do metadata <- getMetadata id' - let tryField k fmt = M.lookup k metadata >>= parseTime' fmt + let tryField k fmt = lookupString k metadata >>= parseTime' fmt paths = splitDirectories $ toFilePath id' maybe empty' return $ msum $ |