summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
--------------------------------------------------------------------------------