on master help sign in
Renamed RenderAction to HakyllAction.
fa28eacJasper Van der Jeugt
hakyll.cabal+1−1
@@ -48,7 +48,7 @@ library
48 Text.Hakyll.Hakyll
48 Text.Hakyll.Hakyll
49 Text.Hakyll.Regex
49 Text.Hakyll.Regex
50 Text.Hakyll.Render
50 Text.Hakyll.Render
51− Text.Hakyll.RenderAction
51+ Text.Hakyll.HakyllAction
52 Text.Hakyll.Renderables
52 Text.Hakyll.Renderables
53 Text.Hakyll.Paginate
53 Text.Hakyll.Paginate
54 Text.Hakyll.Util
54 Text.Hakyll.Util
src/Text/Hakyll/Feed.hs+2−2
@@ -34,7 +34,7 @@ import Text.Hakyll.Context (ContextManipulation, renderDate)
34import Text.Hakyll.Hakyll (Hakyll)
34import Text.Hakyll.Hakyll (Hakyll)
35import Text.Hakyll.Render (render, renderChain)
35import Text.Hakyll.Render (render, renderChain)
36import Text.Hakyll.Renderables (createListingWith)
36import Text.Hakyll.Renderables (createListingWith)
37−import Text.Hakyll.RenderAction
37+import Text.Hakyll.HakyllAction
38
38
39import Paths_hakyll
39import Paths_hakyll
40
40
@@ -71,7 +71,7 @@ createFeedWith manipulation configuration renderables template itemTemplate =
71 ] ++ updated
71 ] ++ updated
72
72
73 -- Take the first timestamp, which should be the most recent.
73 -- Take the first timestamp, which should be the most recent.
74− updated = let action = createRenderAction $
74+ updated = let action = createHakyllAction $
75 return . fromMaybe "foo" . M.lookup "timestamp"
75 return . fromMaybe "foo" . M.lookup "timestamp"
76 manip = createManipulationAction manipulation
76 manip = createManipulationAction manipulation
77 toTuple r = ("timestamp", Right $ r >>> manip >>> action)
77 toTuple r = ("timestamp", Right $ r >>> manip >>> action)
src/Text/Hakyll/RenderAction.hs → src/Text/Hakyll/HakyllAction.hsrenamed+43−43
@@ -1,13 +1,13 @@
1−-- | This is the module which exports @RenderAction@.
1+-- | This is the module which exports @HakyllAction@.
2−module Text.Hakyll.RenderAction
2+module Text.Hakyll.HakyllAction
3− ( RenderAction (..)
3+ ( HakyllAction (..)
4− , createRenderAction
4+ , createHakyllAction
5− , createSimpleRenderAction
5+ , createSimpleHakyllAction
6− , createFileRenderAction
6+ , createFileHakyllAction
7 , createManipulationAction
7 , createManipulationAction
8 , chain
8 , chain
9− , runRenderAction
9+ , runHakyllAction
10− , runRenderActionIfNeeded
10+ , runHakyllActionIfNeeded
11 , Renderable
11 , Renderable
12 ) where
12 ) where
13
13
@@ -23,85 +23,85 @@ import Text.Hakyll.File (toDestination, isFileMoreRecent)
23import Text.Hakyll.Hakyll
23import Text.Hakyll.Hakyll
24
24
25-- | Type used for rendering computations that carry along dependencies.
25-- | Type used for rendering computations that carry along dependencies.
26−data RenderAction a b = RenderAction
26+data HakyllAction a b = HakyllAction
27− { -- | Dependencies of the @RenderAction@.
27+ { -- | Dependencies of the @HakyllAction@.
28 actionDependencies :: [FilePath]
28 actionDependencies :: [FilePath]
29− , -- | URL pointing to the result of this @RenderAction@.
29+ , -- | URL pointing to the result of this @HakyllAction@.
30 actionUrl :: Maybe (Hakyll FilePath)
30 actionUrl :: Maybe (Hakyll FilePath)
31 , -- | The actual render function.
31 , -- | The actual render function.
32 actionFunction :: a -> Hakyll b
32 actionFunction :: a -> Hakyll b
33 }
33 }
34
34
35−-- | Create a @RenderAction@ from a function.
35+-- | Create a @HakyllAction@ from a function.
36−createRenderAction :: (a -> Hakyll b) -- ^ Function to execute.
36+createHakyllAction :: (a -> Hakyll b) -- ^ Function to execute.
37− -> RenderAction a b
37+ -> HakyllAction a b
38−createRenderAction f = id { actionFunction = f }
38+createHakyllAction f = id { actionFunction = f }
39
39
40−-- | Create a @RenderAction@ from a simple @Hakyll@ value.
40+-- | Create a @HakyllAction@ from a simple @Hakyll@ value.
41−createSimpleRenderAction :: Hakyll b -- ^ Hakyll value to pass on.
41+createSimpleHakyllAction :: Hakyll b -- ^ Hakyll value to pass on.
42− -> RenderAction () b
42+ -> HakyllAction () b
43−createSimpleRenderAction = createRenderAction . const
43+createSimpleHakyllAction = createHakyllAction . const
44
44
45−-- | Create a @RenderAction@ that operates on one file.
45+-- | Create a @HakyllAction@ that operates on one file.
46−createFileRenderAction :: FilePath -- ^ File to operate on.
46+createFileHakyllAction :: FilePath -- ^ File to operate on.
47 -> Hakyll b -- ^ Value to pass on.
47 -> Hakyll b -- ^ Value to pass on.
48− -> RenderAction () b -- ^ The resulting action.
48+ -> HakyllAction () b -- ^ The resulting action.
49−createFileRenderAction path action = RenderAction
49+createFileHakyllAction path action = HakyllAction
50 { actionDependencies = [path]
50 { actionDependencies = [path]
51 , actionUrl = Just $ return path
51 , actionUrl = Just $ return path
52 , actionFunction = const action
52 , actionFunction = const action
53 }
53 }
54
54
55−-- | Create a @RenderAction@ from a @ContextManipulation@.
55+-- | Create a @HakyllAction@ from a @ContextManipulation@.
56createManipulationAction :: ContextManipulation -- ^ Manipulation to apply.
56createManipulationAction :: ContextManipulation -- ^ Manipulation to apply.
57− -> RenderAction Context Context
57+ -> HakyllAction Context Context
58−createManipulationAction = createRenderAction . (return .)
58+createManipulationAction = createHakyllAction . (return .)
59
59
60−-- | Run a @RenderAction@ now.
60+-- | Run a @HakyllAction@ now.
61−runRenderAction :: RenderAction () a -- ^ Render action to run.
61+runHakyllAction :: HakyllAction () a -- ^ Render action to run.
62 -> Hakyll a -- ^ Result of the action.
62 -> Hakyll a -- ^ Result of the action.
63−runRenderAction action = actionFunction action ()
63+runHakyllAction action = actionFunction action ()
64
64
65−-- | Run a @RenderAction@, but only when it is out-of-date. At this point, the
65+-- | Run a @HakyllAction@, but only when it is out-of-date. At this point, the
66-- @actionUrl@ field must be set.
66-- @actionUrl@ field must be set.
67−runRenderActionIfNeeded :: RenderAction () () -- ^ Action to run.
67+runHakyllActionIfNeeded :: HakyllAction () () -- ^ Action to run.
68 -> Hakyll () -- ^ Empty result.
68 -> Hakyll () -- ^ Empty result.
69−runRenderActionIfNeeded action = do
69+runHakyllActionIfNeeded action = do
70 url <- case actionUrl action of
70 url <- case actionUrl action of
71 (Just u) -> u
71 (Just u) -> u
72 Nothing -> error "No url when checking dependencies."
72 Nothing -> error "No url when checking dependencies."
73 destination <- toDestination url
73 destination <- toDestination url
74 valid <- isFileMoreRecent destination $ actionDependencies action
74 valid <- isFileMoreRecent destination $ actionDependencies action
75 unless valid $ do liftIO $ hPutStrLn stderr $ "Rendering " ++ destination
75 unless valid $ do liftIO $ hPutStrLn stderr $ "Rendering " ++ destination
76− runRenderAction action
76+ runHakyllAction action
77
77
78−-- | Chain a number of @RenderAction@ computations.
78+-- | Chain a number of @HakyllAction@ computations.
79−chain :: [RenderAction a a] -- ^ Actions to chain.
79+chain :: [HakyllAction a a] -- ^ Actions to chain.
80− -> RenderAction a a -- ^ Resulting action.
80+ -> HakyllAction a a -- ^ Resulting action.
81chain [] = id
81chain [] = id
82chain list@(_:_) = foldl1 (>>>) list
82chain list@(_:_) = foldl1 (>>>) list
83
83
84−-- | This is a specialized version of @RenderAction@, a @Context@ that can be
84+-- | This is a specialized version of @HakyllAction@, a @Context@ that can be
85-- rendered.
85-- rendered.
86−type Renderable = RenderAction () Context
86+type Renderable = HakyllAction () Context
87
87
88−instance Category RenderAction where
88+instance Category HakyllAction where
89− id = RenderAction
89+ id = HakyllAction
90 { actionDependencies = []
90 { actionDependencies = []
91 , actionUrl = Nothing
91 , actionUrl = Nothing
92 , actionFunction = return
92 , actionFunction = return
93 }
93 }
94
94
95− x . y = RenderAction
95+ x . y = HakyllAction
96 { actionDependencies = actionDependencies x ++ actionDependencies y
96 { actionDependencies = actionDependencies x ++ actionDependencies y
97 , actionUrl = actionUrl y `mplus` actionUrl x
97 , actionUrl = actionUrl y `mplus` actionUrl x
98 , actionFunction = actionFunction x <=< actionFunction y
98 , actionFunction = actionFunction x <=< actionFunction y
99 }
99 }
100
100
101−instance Arrow RenderAction where
101+instance Arrow HakyllAction where
102 arr f = id { actionFunction = return . f }
102 arr f = id { actionFunction = return . f }
103
103
104− first x = RenderAction
104+ first x = HakyllAction
105 { actionDependencies = actionDependencies x
105 { actionDependencies = actionDependencies x
106 , actionUrl = actionUrl x
106 , actionUrl = actionUrl x
107 , actionFunction = \(y, z) -> do y' <- actionFunction x y
107 , actionFunction = \(y, z) -> do y' <- actionFunction x y
src/Text/Hakyll/Internal/Render.hs+3−3
@@ -14,7 +14,7 @@ import Data.Maybe (fromMaybe)
14import Text.Hakyll.Context (Context, ContextManipulation)
14import Text.Hakyll.Context (Context, ContextManipulation)
15import Text.Hakyll.File
15import Text.Hakyll.File
16import Text.Hakyll.Hakyll
16import Text.Hakyll.Hakyll
17−import Text.Hakyll.RenderAction
17+import Text.Hakyll.HakyllAction
18import Text.Hakyll.Internal.Template
18import Text.Hakyll.Internal.Template
19
19
20-- | A pure render function.
20-- | A pure render function.
@@ -31,8 +31,8 @@ pureRenderWith manipulation template context =
31
31
32-- | Write a page to the site destination. Final action after render
32-- | Write a page to the site destination. Final action after render
33-- chains and such.
33-- chains and such.
34−writePage :: RenderAction Context ()
34+writePage :: HakyllAction Context ()
35−writePage = createRenderAction $ \initialContext -> do
35+writePage = createHakyllAction $ \initialContext -> do
36 additionalContext' <- askHakyll getAdditionalContext
36 additionalContext' <- askHakyll getAdditionalContext
37 let url = fromMaybe (error "No url defined at write time.")
37 let url = fromMaybe (error "No url defined at write time.")
38 (M.lookup "url" initialContext)
38 (M.lookup "url" initialContext)
src/Text/Hakyll/Paginate.hs+2−2
@@ -8,7 +8,7 @@ module Text.Hakyll.Paginate
8import Control.Applicative ((<$>))
8import Control.Applicative ((<$>))
9
9
10import Text.Hakyll.Renderables
10import Text.Hakyll.Renderables
11−import Text.Hakyll.RenderAction
11+import Text.Hakyll.HakyllAction
12import Text.Hakyll.Util (link)
12import Text.Hakyll.Util (link)
13
13
14-- | A configuration for a pagination.
14-- | A configuration for a pagination.
@@ -60,7 +60,7 @@ paginate configuration renderables = paginate' Nothing renderables (1 :: Int)
60 where
60 where
61 -- Create a link with a given label, taken from the configuration.
61 -- Create a link with a given label, taken from the configuration.
62 linkWithLabel f r = Right $ case actionUrl r of
62 linkWithLabel f r = Right $ case actionUrl r of
63− Just l -> createSimpleRenderAction $ link (f configuration) <$> l
63+ Just l -> createSimpleHakyllAction $ link (f configuration) <$> l
64 Nothing -> error "No link found for pagination."
64 Nothing -> error "No link found for pagination."
65
65
66 -- The main function that creates combined renderables by recursing over
66 -- The main function that creates combined renderables by recursing over
src/Text/Hakyll/Render.hs+14−14
@@ -20,22 +20,22 @@ import qualified Data.Map as M
20import Text.Hakyll.Hakyll (Hakyll)
20import Text.Hakyll.Hakyll (Hakyll)
21import Text.Hakyll.Context (ContextManipulation, Context)
21import Text.Hakyll.Context (ContextManipulation, Context)
22import Text.Hakyll.File
22import Text.Hakyll.File
23−import Text.Hakyll.RenderAction
23+import Text.Hakyll.HakyllAction
24import Text.Hakyll.Internal.CompressCss
24import Text.Hakyll.Internal.CompressCss
25import Text.Hakyll.Internal.Render
25import Text.Hakyll.Internal.Render
26import Text.Hakyll.Internal.Template (readTemplate)
26import Text.Hakyll.Internal.Template (readTemplate)
27
27
28-- | Render to a Page.
28-- | Render to a Page.
29render :: FilePath -- ^ Template to use for rendering.
29render :: FilePath -- ^ Template to use for rendering.
30− -> RenderAction Context Context -- ^ The render computation.
30+ -> HakyllAction Context Context -- ^ The render computation.
31render = renderWith id
31render = renderWith id
32
32
33-- | Render to a Page. This function allows you to manipulate the context
33-- | Render to a Page. This function allows you to manipulate the context
34-- first.
34-- first.
35renderWith :: ContextManipulation -- ^ Manipulation to apply first.
35renderWith :: ContextManipulation -- ^ Manipulation to apply first.
36 -> FilePath -- ^ Template to use for rendering.
36 -> FilePath -- ^ Template to use for rendering.
37− -> RenderAction Context Context -- ^ The render computation.
37+ -> HakyllAction Context Context -- ^ The render computation.
38−renderWith manipulation templatePath = RenderAction
38+renderWith manipulation templatePath = HakyllAction
39 { actionDependencies = [templatePath]
39 { actionDependencies = [templatePath]
40 , actionUrl = Nothing
40 , actionUrl = Nothing
41 , actionFunction = actionFunction'
41 , actionFunction = actionFunction'
@@ -57,7 +57,7 @@ renderWith manipulation templatePath = RenderAction
57--
57--
58renderAndConcat :: [FilePath] -- ^ Templates to apply on every renderable.
58renderAndConcat :: [FilePath] -- ^ Templates to apply on every renderable.
59 -> [Renderable] -- ^ Renderables to render.
59 -> [Renderable] -- ^ Renderables to render.
60− -> RenderAction () String
60+ -> HakyllAction () String
61renderAndConcat = renderAndConcatWith id
61renderAndConcat = renderAndConcatWith id
62
62
63-- | Render each renderable with the given templates, then concatenate the
63-- | Render each renderable with the given templates, then concatenate the
@@ -66,8 +66,8 @@ renderAndConcat = renderAndConcatWith id
66renderAndConcatWith :: ContextManipulation
66renderAndConcatWith :: ContextManipulation
67 -> [FilePath]
67 -> [FilePath]
68 -> [Renderable]
68 -> [Renderable]
69− -> RenderAction () String
69+ -> HakyllAction () String
70−renderAndConcatWith manipulation templatePaths renderables = RenderAction
70+renderAndConcatWith manipulation templatePaths renderables = HakyllAction
71 { actionDependencies = renders >>= actionDependencies
71 { actionDependencies = renders >>= actionDependencies
72 , actionUrl = Nothing
72 , actionUrl = Nothing
73 , actionFunction = actionFunction'
73 , actionFunction = actionFunction'
@@ -78,7 +78,7 @@ renderAndConcatWith manipulation templatePaths renderables = RenderAction
78 manipulationAction = createManipulationAction manipulation
78 manipulationAction = createManipulationAction manipulation
79
79
80 actionFunction' _ = do
80 actionFunction' _ = do
81− contexts <- mapM runRenderAction renders
81+ contexts <- mapM runHakyllAction renders
82 return $ concatMap (fromMaybe "" . M.lookup "body") contexts
82 return $ concatMap (fromMaybe "" . M.lookup "body") contexts
83
83
84-- | Chain a render action for a page with a number of templates. This will
84-- | Chain a render action for a page with a number of templates. This will
@@ -101,9 +101,9 @@ renderChainWith :: ContextManipulation
101 -> Renderable
101 -> Renderable
102 -> Hakyll ()
102 -> Hakyll ()
103renderChainWith manipulation templatePaths initial =
103renderChainWith manipulation templatePaths initial =
104− runRenderActionIfNeeded renderChainWith'
104+ runHakyllActionIfNeeded renderChainWith'
105 where
105 where
106− renderChainWith' :: RenderAction () ()
106+ renderChainWith' :: HakyllAction () ()
107 renderChainWith' = initial >>> manipulationAction >>> chain' >>> writePage
107 renderChainWith' = initial >>> manipulationAction >>> chain' >>> writePage
108
108
109 chain' = chain (map render templatePaths)
109 chain' = chain (map render templatePaths)
@@ -113,18 +113,18 @@ renderChainWith manipulation templatePaths initial =
113-- | Mark a certain file as static, so it will just be copied when the site is
113-- | Mark a certain file as static, so it will just be copied when the site is
114-- generated.
114-- generated.
115static :: FilePath -> Hakyll ()
115static :: FilePath -> Hakyll ()
116−static source = runRenderActionIfNeeded static'
116+static source = runHakyllActionIfNeeded static'
117 where
117 where
118− static' = createFileRenderAction source $ do
118+ static' = createFileHakyllAction source $ do
119 destination <- toDestination source
119 destination <- toDestination source
120 makeDirectories destination
120 makeDirectories destination
121 liftIO $ copyFile source destination
121 liftIO $ copyFile source destination
122
122
123-- | Render a css file, compressing it.
123-- | Render a css file, compressing it.
124css :: FilePath -> Hakyll ()
124css :: FilePath -> Hakyll ()
125−css source = runRenderActionIfNeeded css'
125+css source = runHakyllActionIfNeeded css'
126 where
126 where
127− css' = createFileRenderAction source $ do
127+ css' = createFileHakyllAction source $ do
128 contents <- liftIO $ readFile source
128 contents <- liftIO $ readFile source
129 destination <- toDestination source
129 destination <- toDestination source
130 makeDirectories destination
130 makeDirectories destination
src/Text/Hakyll/Renderables.hs+10−10
@@ -14,7 +14,7 @@ import Control.Applicative ((<$>))
14
14
15import Text.Hakyll.File
15import Text.Hakyll.File
16import Text.Hakyll.Context
16import Text.Hakyll.Context
17−import Text.Hakyll.RenderAction
17+import Text.Hakyll.HakyllAction
18import Text.Hakyll.Render
18import Text.Hakyll.Render
19import Text.Hakyll.Internal.Page
19import Text.Hakyll.Internal.Page
20
20
@@ -26,16 +26,16 @@ import Text.Hakyll.Internal.Page
26-- dependency checking. A @String@ is obviously more simple to use in some
26-- dependency checking. A @String@ is obviously more simple to use in some
27-- cases.
27-- cases.
28createCustomPage :: String
28createCustomPage :: String
29− -> [(String, Either String (RenderAction () String))]
29+ -> [(String, Either String (HakyllAction () String))]
30 -> Renderable
30 -> Renderable
31−createCustomPage url association = RenderAction
31+createCustomPage url association = HakyllAction
32 { actionDependencies = dataDependencies
32 { actionDependencies = dataDependencies
33 , actionUrl = Just $ return url
33 , actionUrl = Just $ return url
34 , actionFunction = \_ -> M.fromList <$> assoc'
34 , actionFunction = \_ -> M.fromList <$> assoc'
35 }
35 }
36 where
36 where
37 mtuple (a, b) = b >>= \b' -> return (a, b')
37 mtuple (a, b) = b >>= \b' -> return (a, b')
38− toHakyllString = second (either return runRenderAction)
38+ toHakyllString = second (either return runHakyllAction)
39 assoc' = mapM (mtuple . toHakyllString) $ ("url", Left url) : association
39 assoc' = mapM (mtuple . toHakyllString) $ ("url", Left url) : association
40 dataDependencies = map snd association >>= getDependencies
40 dataDependencies = map snd association >>= getDependencies
41 getDependencies (Left _) = []
41 getDependencies (Left _) = []
@@ -57,7 +57,7 @@ createCustomPage url association = RenderAction
57createListing :: String -- ^ Destination of the page.
57createListing :: String -- ^ Destination of the page.
58 -> [FilePath] -- ^ Templates to render all items with.
58 -> [FilePath] -- ^ Templates to render all items with.
59 -> [Renderable] -- ^ Renderables in the list.
59 -> [Renderable] -- ^ Renderables in the list.
60− -> [(String, Either String (RenderAction () String))]
60+ -> [(String, Either String (HakyllAction () String))]
61 -> Renderable
61 -> Renderable
62createListing = createListingWith id
62createListing = createListingWith id
63
63
@@ -69,7 +69,7 @@ createListingWith :: ContextManipulation -- ^ Manipulation for the renderables.
69 -> String -- ^ Destination of the page.
69 -> String -- ^ Destination of the page.
70 -> [FilePath] -- ^ Templates to render all items with.
70 -> [FilePath] -- ^ Templates to render all items with.
71 -> [Renderable] -- ^ Renderables in the list.
71 -> [Renderable] -- ^ Renderables in the list.
72− -> [(String, Either String (RenderAction () String))]
72+ -> [(String, Either String (HakyllAction () String))]
73 -> Renderable
73 -> Renderable
74createListingWith manipulation url templates renderables additional =
74createListingWith manipulation url templates renderables additional =
75 createCustomPage url context
75 createCustomPage url context
@@ -79,7 +79,7 @@ createListingWith manipulation url templates renderables additional =
79
79
80-- | Create a PagePath from a FilePath.
80-- | Create a PagePath from a FilePath.
81createPagePath :: FilePath -> Renderable
81createPagePath :: FilePath -> Renderable
82−createPagePath path = RenderAction
82+createPagePath path = HakyllAction
83 { actionDependencies = [path]
83 { actionDependencies = [path]
84 , actionUrl = Just $ toUrl path
84 , actionUrl = Just $ toUrl path
85 , actionFunction = const (readPage path)
85 , actionFunction = const (readPage path)
@@ -93,11 +93,11 @@ createPagePath path = RenderAction
93-- this as a @union@ between two maps.
93-- this as a @union@ between two maps.
94combine :: Renderable -> Renderable
94combine :: Renderable -> Renderable
95 -> Renderable
95 -> Renderable
96−combine x y = RenderAction
96+combine x y = HakyllAction
97 { actionDependencies = actionDependencies x ++ actionDependencies y
97 { actionDependencies = actionDependencies x ++ actionDependencies y
98 , actionUrl = actionUrl x `mplus` actionUrl y
98 , actionUrl = actionUrl x `mplus` actionUrl y
99 , actionFunction = \_ ->
99 , actionFunction = \_ ->
100− liftM2 M.union (runRenderAction x) (runRenderAction y)
100+ liftM2 M.union (runHakyllAction x) (runHakyllAction y)
101 }
101 }
102
102
103-- | Combine two renderables and set a custom URL. This behaves like @combine@,
103-- | Combine two renderables and set a custom URL. This behaves like @combine@,
@@ -109,7 +109,7 @@ combineWithUrl :: FilePath
109combineWithUrl url x y = combine'
109combineWithUrl url x y = combine'
110 { actionUrl = Just $ return url
110 { actionUrl = Just $ return url
111 , actionFunction = \_ ->
111 , actionFunction = \_ ->
112− M.insert "url" url <$> runRenderAction combine'
112+ M.insert "url" url <$> runHakyllAction combine'
113 }
113 }
114 where
114 where
115 combine' = combine x y
115 combine' = combine x y
src/Text/Hakyll/Tags.hs+11−11
@@ -48,7 +48,7 @@ import Text.Hakyll.Context
48import Text.Hakyll.Hakyll (Hakyll)
48import Text.Hakyll.Hakyll (Hakyll)
49import Text.Hakyll.Regex
49import Text.Hakyll.Regex
50import Text.Hakyll.Renderables
50import Text.Hakyll.Renderables
51−import Text.Hakyll.RenderAction
51+import Text.Hakyll.HakyllAction
52import Text.Hakyll.Util
52import Text.Hakyll.Util
53import Text.Hakyll.Internal.Cache
53import Text.Hakyll.Internal.Cache
54import Text.Hakyll.Internal.Template
54import Text.Hakyll.Internal.Template
@@ -65,8 +65,8 @@ type TagMap = M.Map String [Renderable]
65readMap :: (Context -> [String]) -- ^ Function to get tags from a context.
65readMap :: (Context -> [String]) -- ^ Function to get tags from a context.
66 -> String -- ^ Unique identifier for the tagmap.
66 -> String -- ^ Unique identifier for the tagmap.
67 -> [FilePath]
67 -> [FilePath]
68− -> RenderAction () TagMap
68+ -> HakyllAction () TagMap
69−readMap getTagsFunction identifier paths = RenderAction
69+readMap getTagsFunction identifier paths = HakyllAction
70 { actionDependencies = paths
70 { actionDependencies = paths
71 , actionUrl = Nothing
71 , actionUrl = Nothing
72 , actionFunction = actionFunction'
72 , actionFunction = actionFunction'
@@ -85,7 +85,7 @@ readMap getTagsFunction identifier paths = RenderAction
85
85
86 readTagMap' = foldM addPaths M.empty paths
86 readTagMap' = foldM addPaths M.empty paths
87 addPaths current path = do
87 addPaths current path = do
88− context <- runRenderAction $ createPagePath path
88+ context <- runHakyllAction $ createPagePath path
89 let tags = getTagsFunction context
89 let tags = getTagsFunction context
90 addPaths' = flip (M.insertWith (++)) [path]
90 addPaths' = flip (M.insertWith (++)) [path]
91 return $ foldr addPaths' current tags
91 return $ foldr addPaths' current tags
@@ -93,7 +93,7 @@ readMap getTagsFunction identifier paths = RenderAction
93-- | Read a @TagMap@, using the @tags@ metadata field.
93-- | Read a @TagMap@, using the @tags@ metadata field.
94readTagMap :: String -- ^ Unique identifier for the map.
94readTagMap :: String -- ^ Unique identifier for the map.
95 -> [FilePath] -- ^ Paths to get tags from.
95 -> [FilePath] -- ^ Paths to get tags from.
96− -> RenderAction () TagMap
96+ -> HakyllAction () TagMap
97readTagMap = readMap getTagsFunction
97readTagMap = readMap getTagsFunction
98 where
98 where
99 getTagsFunction = map trim . splitRegex ","
99 getTagsFunction = map trim . splitRegex ","
@@ -102,22 +102,22 @@ readTagMap = readMap getTagsFunction
102-- | Read a @TagMap@, using the subdirectories the pages are placed in.
102-- | Read a @TagMap@, using the subdirectories the pages are placed in.
103readCategoryMap :: String -- ^ Unique identifier for the map.
103readCategoryMap :: String -- ^ Unique identifier for the map.
104 -> [FilePath] -- ^ Paths to get tags from.
104 -> [FilePath] -- ^ Paths to get tags from.
105− -> RenderAction () TagMap
105+ -> HakyllAction () TagMap
106readCategoryMap = readMap $ maybeToList . M.lookup "category"
106readCategoryMap = readMap $ maybeToList . M.lookup "category"
107
107
108−withTagMap :: RenderAction () TagMap
108+withTagMap :: HakyllAction () TagMap
109 -> (String -> [Renderable] -> Hakyll ())
109 -> (String -> [Renderable] -> Hakyll ())
110 -> Hakyll ()
110 -> Hakyll ()
111−withTagMap tagMap function = runRenderAction (tagMap >>> action)
111+withTagMap tagMap function = runHakyllAction (tagMap >>> action)
112 where
112 where
113− action = createRenderAction (mapM_ (uncurry function) . M.toList)
113+ action = createHakyllAction (mapM_ (uncurry function) . M.toList)
114
114
115-- | Render a tag cloud.
115-- | Render a tag cloud.
116renderTagCloud :: (String -> String) -- ^ Function to produce an url for a tag.
116renderTagCloud :: (String -> String) -- ^ Function to produce an url for a tag.
117 -> Float -- ^ Smallest font size, in percent.
117 -> Float -- ^ Smallest font size, in percent.
118 -> Float -- ^ Biggest font size, in percent.
118 -> Float -- ^ Biggest font size, in percent.
119− -> RenderAction TagMap String
119+ -> HakyllAction TagMap String
120−renderTagCloud urlFunction minSize maxSize = createRenderAction renderTagCloud'
120+renderTagCloud urlFunction minSize maxSize = createHakyllAction renderTagCloud'
121 where
121 where
122 renderTagCloud' tagMap =
122 renderTagCloud' tagMap =
123 return $ intercalate " " $ map (renderTag tagMap) (tagCount tagMap)
123 return $ intercalate " " $ map (renderTag tagMap) (tagCount tagMap)