summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2014-01-03 16:40:15 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2014-01-03 16:40:15 +0100
commitb61877bdaaef8dd6ea8ffc406a2e60d7b104d0aa (patch)
tree811d03a5431397962a210ff200b9b73f249f887c /src/Hakyll
parent55a389ee7c9a33337679d24c669c4556cbd77cab (diff)
downloadhakyll-b61877bdaaef8dd6ea8ffc406a2e60d7b104d0aa.tar.gz
Fix issue with metadataRoute for composed routes
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Core/Routes.hs18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Hakyll/Core/Routes.hs b/src/Hakyll/Core/Routes.hs
index 34a613d..470d727 100644
--- a/src/Hakyll/Core/Routes.hs
+++ b/src/Hakyll/Core/Routes.hs
@@ -61,9 +61,16 @@ type UsedMetadata = Bool
--------------------------------------------------------------------------------
+data RoutesRead = RoutesRead
+ { routesProvider :: Provider
+ , routesUnderlying :: Identifier
+ }
+
+
+--------------------------------------------------------------------------------
-- | Type used for a route
newtype Routes = Routes
- { unRoutes :: Provider -> Identifier -> IO (Maybe FilePath, UsedMetadata)
+ { unRoutes :: RoutesRead -> Identifier -> IO (Maybe FilePath, UsedMetadata)
}
@@ -81,7 +88,8 @@ instance Monoid Routes where
-- | Apply a route to an identifier
runRoutes :: Routes -> Provider -> Identifier
-> IO (Maybe FilePath, UsedMetadata)
-runRoutes = unRoutes
+runRoutes routes provider identifier =
+ unRoutes routes (RoutesRead provider identifier) identifier
--------------------------------------------------------------------------------
@@ -156,9 +164,9 @@ gsubRoute pattern replacement = customRoute $
--------------------------------------------------------------------------------
-- | Get access to the metadata in order to determine the route
metadataRoute :: (Metadata -> Routes) -> Routes
-metadataRoute f = Routes $ \p i -> do
- metadata <- resourceMetadata p i
- unRoutes (f metadata) p i
+metadataRoute f = Routes $ \r i -> do
+ metadata <- resourceMetadata (routesProvider r) (routesUnderlying r)
+ unRoutes (f metadata) r i
--------------------------------------------------------------------------------