@@ -12,7 +12,6 @@ import Control.Arrow (second)
1212import Control.Monad (liftM2, mplus)
1313import Control.Applicative ((<$>))
1414
15−
1615import Text.Hakyll.File
1716import Text.Hakyll.Context
1817import Text.Hakyll.RenderAction
@@ -29,9 +28,9 @@ import Text.Hakyll.Internal.Page
2928createCustomPage :: String
3029 -> [FilePath]
3130 -> [(String, Either String (RenderAction () String))]
32− -> RenderAction () Context
31+ -> Renderable
3332createCustomPage url dependencies association = RenderAction
34− { actionDependencies = dependencies
33+ { actionDependencies = dependencies ++ dataDependencies
3534 , actionUrl = Just $ return url
3635 , actionFunction = \_ -> M.fromList <$> assoc'
3736 }
@@ -39,6 +38,9 @@ createCustomPage url dependencies association = RenderAction
3938 mtuple (a, b) = b >>= \b' -> return (a, b')
4039 toHakyllString = second (either return runRenderAction)
4140 assoc' = mapM (mtuple . toHakyllString) $ ("url", Left url) : association
41+ dataDependencies = (map snd association) >>= getDependencies
42+ getDependencies (Left _) = []
43+ getDependencies (Right x) = actionDependencies x
4244
4345-- | A @createCustomPage@ function specialized in creating listings.
4446--
@@ -55,9 +57,9 @@ createCustomPage url dependencies association = RenderAction
5557-- > [("title", "Home")] -- ^ Additional context
5658createListing :: String -- ^ Destination of the page.
5759 -> FilePath -- ^ Template to render all items with.
58− -> [RenderAction () Context] -- ^ Renderables in the list.
60+ -> [Renderable] -- ^ Renderables in the list.
5961 -> [(String, String)] -- ^ Additional context.
60− -> RenderAction () Context
62+ -> Renderable
6163createListing = createListingWith id
6264
6365-- | A @createCustomPage@ function specialized in creating listings.
@@ -67,9 +69,9 @@ createListing = createListingWith id
6769createListingWith :: ContextManipulation -- ^ Manipulation for the renderables.
6870 -> String -- ^ Destination of the page.
6971 -> FilePath -- ^ Template to render all items with.
70− -> [RenderAction () Context] -- ^ Renderables in the list.
72+ -> [Renderable] -- ^ Renderables in the list.
7173 -> [(String, String)] -- ^ Additional context.
72− -> RenderAction () Context
74+ -> Renderable
7375createListingWith manipulation url template renderables additional =
7476 createCustomPage url dependencies context
7577 where
@@ -79,7 +81,7 @@ createListingWith manipulation url template renderables additional =
7981 additional' = map (second Left) additional
8082
8183-- | Create a PagePath from a FilePath.
82−createPagePath :: FilePath -> RenderAction () Context
84+createPagePath :: FilePath -> Renderable
8385createPagePath path = RenderAction
8486 { actionDependencies = [path]
8587 , actionUrl = Just $ toUrl path
@@ -92,8 +94,8 @@ createPagePath path = RenderAction
9294--
9395-- Since renderables are always more or less key-value maps, you can see
9496-- this as a @union@ between two maps.
95−combine :: RenderAction () Context -> RenderAction () Context
96− -> RenderAction () Context
97+combine :: Renderable -> Renderable
98+ -> Renderable
9799combine x y = RenderAction
98100 { actionDependencies = actionDependencies x ++ actionDependencies y
99101 , actionUrl = actionUrl x `mplus` actionUrl y
@@ -104,9 +106,9 @@ combine x y = RenderAction
104106-- | Combine two renderables and set a custom URL. This behaves like @combine@,
105107-- except that for the @url@ field, the given URL is always chosen.
106108combineWithUrl :: FilePath
107− -> RenderAction () Context
108− -> RenderAction () Context
109− -> RenderAction () Context
109+ -> Renderable
110+ -> Renderable
111+ -> Renderable
110112combineWithUrl url x y = combine'
111113 { actionUrl = Just $ return url
112114 , actionFunction = \_ ->