@@ -12,7 +12,6 @@ import Control.Arrow (second)
12import Control.Monad (liftM2, mplus)
12import Control.Monad (liftM2, mplus)
13import Control.Applicative ((<$>))
13import Control.Applicative ((<$>))
16import Text.Hakyll.File
15import Text.Hakyll.File
17import Text.Hakyll.Context
16import Text.Hakyll.Context
18import Text.Hakyll.RenderAction
17import Text.Hakyll.RenderAction
@@ -29,9 +28,9 @@ import Text.Hakyll.Internal.Page
29createCustomPage :: String
28createCustomPage :: String
30 -> [FilePath]
29 -> [FilePath]
31 -> [(String, Either String (RenderAction () String))]
30 -> [(String, Either String (RenderAction () String))]
32− -> RenderAction () Context
31+ -> Renderable
33createCustomPage url dependencies association = RenderAction
32createCustomPage url dependencies association = RenderAction
34− { actionDependencies = dependencies
33+ { actionDependencies = dependencies ++ dataDependencies
35 , actionUrl = Just $ return url
34 , actionUrl = Just $ return url
36 , actionFunction = \_ -> M.fromList <$> assoc'
35 , actionFunction = \_ -> M.fromList <$> assoc'
@@ -39,6 +38,9 @@ createCustomPage url dependencies association = RenderAction
39 mtuple (a, b) = b >>= \b' -> return (a, b')
38 mtuple (a, b) = b >>= \b' -> return (a, b')
40 toHakyllString = second (either return runRenderAction)
39 toHakyllString = second (either return runRenderAction)
41 assoc' = mapM (mtuple . toHakyllString) $ ("url", Left url) : association
40 assoc' = mapM (mtuple . toHakyllString) $ ("url", Left url) : association
41+ dataDependencies = (map snd association) >>= getDependencies
42+ getDependencies (Left _) = []
43+ getDependencies (Right x) = actionDependencies x
43-- | A @createCustomPage@ function specialized in creating listings.
45-- | A @createCustomPage@ function specialized in creating listings.
@@ -55,9 +57,9 @@ createCustomPage url dependencies association = RenderAction
55-- > [("title", "Home")] -- ^ Additional context
57-- > [("title", "Home")] -- ^ Additional context
56createListing :: String -- ^ Destination of the page.
58createListing :: String -- ^ Destination of the page.
57 -> FilePath -- ^ Template to render all items with.
59 -> FilePath -- ^ Template to render all items with.
58− -> [RenderAction () Context] -- ^ Renderables in the list.
60+ -> [Renderable] -- ^ Renderables in the list.
59 -> [(String, String)] -- ^ Additional context.
61 -> [(String, String)] -- ^ Additional context.
60− -> RenderAction () Context
62+ -> Renderable
61createListing = createListingWith id
63createListing = createListingWith id
63-- | A @createCustomPage@ function specialized in creating listings.
65-- | A @createCustomPage@ function specialized in creating listings.
@@ -67,9 +69,9 @@ createListing = createListingWith id
67createListingWith :: ContextManipulation -- ^ Manipulation for the renderables.
69createListingWith :: ContextManipulation -- ^ Manipulation for the renderables.
68 -> String -- ^ Destination of the page.
70 -> String -- ^ Destination of the page.
69 -> FilePath -- ^ Template to render all items with.
71 -> FilePath -- ^ Template to render all items with.
70− -> [RenderAction () Context] -- ^ Renderables in the list.
72+ -> [Renderable] -- ^ Renderables in the list.
71 -> [(String, String)] -- ^ Additional context.
73 -> [(String, String)] -- ^ Additional context.
72− -> RenderAction () Context
74+ -> Renderable
73createListingWith manipulation url template renderables additional =
75createListingWith manipulation url template renderables additional =
74 createCustomPage url dependencies context
76 createCustomPage url dependencies context
@@ -79,7 +81,7 @@ createListingWith manipulation url template renderables additional =
79 additional' = map (second Left) additional
81 additional' = map (second Left) additional
81-- | Create a PagePath from a FilePath.
83-- | Create a PagePath from a FilePath.
82−createPagePath :: FilePath -> RenderAction () Context
84+createPagePath :: FilePath -> Renderable
83createPagePath path = RenderAction
85createPagePath path = RenderAction
84 { actionDependencies = [path]
86 { actionDependencies = [path]
85 , actionUrl = Just $ toUrl path
87 , actionUrl = Just $ toUrl path
@@ -92,8 +94,8 @@ createPagePath path = RenderAction
93-- Since renderables are always more or less key-value maps, you can see
95-- Since renderables are always more or less key-value maps, you can see
94-- this as a @union@ between two maps.
96-- this as a @union@ between two maps.
95−combine :: RenderAction () Context -> RenderAction () Context
97+combine :: Renderable -> Renderable
96− -> RenderAction () Context
98+ -> Renderable
97combine x y = RenderAction
99combine x y = RenderAction
98 { actionDependencies = actionDependencies x ++ actionDependencies y
100 { actionDependencies = actionDependencies x ++ actionDependencies y
99 , actionUrl = actionUrl x `mplus` actionUrl y
101 , actionUrl = actionUrl x `mplus` actionUrl y
@@ -104,9 +106,9 @@ combine x y = RenderAction
104-- | Combine two renderables and set a custom URL. This behaves like @combine@,
106-- | Combine two renderables and set a custom URL. This behaves like @combine@,
105-- except that for the @url@ field, the given URL is always chosen.
107-- except that for the @url@ field, the given URL is always chosen.
106combineWithUrl :: FilePath
108combineWithUrl :: FilePath
107− -> RenderAction () Context
109+ -> Renderable
108− -> RenderAction () Context
110+ -> Renderable
109− -> RenderAction () Context
111+ -> Renderable
110combineWithUrl url x y = combine'
112combineWithUrl url x y = combine'
111 { actionUrl = Just $ return url
113 { actionUrl = Just $ return url
112 , actionFunction = \_ ->
114 , actionFunction = \_ ->