on master help sign in
Removed xxxWith functions, they can be implemented more elegant using Arrows anyway.
commit23f9d1e0cfb82260b73ce8799756fa6d3a838a70 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateWed 10 Mar 2010, 16:02 (17 years ago) parentfa28eac
9 files changed+95−181
src/Text/Hakyll/Context.hs+16−18 src/Text/Hakyll/Feed.hs+34−64 src/Text/Hakyll/Hakyll.hs+5−2 src/Text/Hakyll/HakyllAction.hs−12 src/Text/Hakyll/Internal/Render.hs+6−11 src/Text/Hakyll/Paginate.hs+3−2 src/Text/Hakyll/Render.hs+13−41 src/Text/Hakyll/Renderables.hs+15−28 src/Text/Hakyll/Tags.hs+3−3
src/Text/Hakyll/Context.hs+16−18
@@ -9,18 +9,17 @@ module Text.Hakyll.Context
99 , changeExtension
1010 ) where
1111
12−import qualified Data.Map as M
13−import Data.Map (Map)
12+import Control.Arrow (arr)
1413import System.Locale (defaultTimeLocale)
1514import System.FilePath (takeFileName, addExtension, dropExtension)
1615import Data.Time.Format (parseTime, formatTime)
1716import Data.Time.Clock (UTCTime)
1817import Data.Maybe (fromMaybe)
18+import qualified Data.Map as M
1919
2020import Text.Hakyll.Regex (substituteRegex)
21−
22−-- | Type for a context.
23−type Context = Map String String
21+import Text.Hakyll.HakyllAction (HakyllAction)
22+import Text.Hakyll.Hakyll (Context)
2423
2524-- | Type for context manipulating functions.
2625type ContextManipulation = Context -> Context
@@ -31,10 +30,11 @@ type ContextManipulation = Context -> Context
3130renderValue :: String -- ^ Key of which the value should be copied.
3231 -> String -- ^ Key the value should be copied to.
3332 -> (String -> String) -- ^ Function to apply on the value.
34− -> ContextManipulation
35−renderValue source destination f context = case M.lookup source context of
36− Nothing -> context
37− (Just value) -> M.insert destination (f value) context
33+ -> HakyllAction Context Context
34+renderValue source destination f = arr $ \context ->
35+ case M.lookup source context of
36+ Nothing -> context
37+ (Just value) -> M.insert destination (f value) context
3838
3939-- | Change a value in a @Context@.
4040--
@@ -44,13 +44,13 @@ renderValue source destination f context = case M.lookup source context of
4444-- Will put the title in UPPERCASE.
4545changeValue :: String -- ^ Key to change.
4646 -> (String -> String) -- ^ Function to apply on the value.
47− -> ContextManipulation
47+ -> HakyllAction Context Context
4848changeValue key = renderValue key key
4949
5050-- | Copy a value from one key to another in a @Context@.
5151copyValue :: String -- ^ Source key.
5252 -> String -- ^ Destination key.
53− -> ContextManipulation
53+ -> HakyllAction Context Context
5454copyValue source destination = renderValue source destination id
5555
5656-- | When the context has a key called @path@ in a @yyyy-mm-dd-title.extension@
@@ -61,13 +61,11 @@ copyValue source destination = renderValue source destination id
6161-- Will render something like @January 32, 2010@.
6262renderDate :: String -- ^ Key in which the rendered date should be placed.
6363 -> String -- ^ Format to use on the date.
64− -> String -- ^ Default value when the date cannot be parsed.
65− -> ContextManipulation
66−renderDate key format defaultValue context = M.insert key value context
64+ -> String -- ^ Default key, in case the date cannot be parsed.
65+ -> HakyllAction Context Context
66+renderDate key format defaultValue = renderValue "path" key renderDate'
6767 where
68− value = fromMaybe defaultValue pretty
69− pretty = do
70− filePath <- M.lookup "path" context
68+ renderDate' filePath = fromMaybe defaultValue $ do
7169 let dateString = substituteRegex "^([0-9]*-[0-9]*-[0-9]*).*" "\\1"
7270 (takeFileName filePath)
7371 time <- parseTime defaultTimeLocale
@@ -84,7 +82,7 @@ renderDate key format defaultValue context = M.insert key value context
8482--
8583-- Will render to @test.php@ instead of @test.html@.
8684changeExtension :: String -- ^ Extension to change to.
87− -> ContextManipulation
85+ -> HakyllAction Context Context
8886changeExtension extension = changeValue "url" changeExtension'
8987 where
9088 changeExtension' = flip addExtension extension . dropExtension
src/Text/Hakyll/Feed.hs+34−64
@@ -20,9 +20,7 @@
2020module Text.Hakyll.Feed
2121 ( FeedConfiguration (..)
2222 , renderRss
23− , renderRssWith
2423 , renderAtom
25− , renderAtomWith
2624 ) where
2725
2826import Control.Arrow ((>>>), second)
@@ -31,9 +29,9 @@ import Data.Maybe (fromMaybe)
3129import qualified Data.Map as M
3230
3331import Text.Hakyll.Context (ContextManipulation, renderDate)
34−import Text.Hakyll.Hakyll (Hakyll)
32+import Text.Hakyll.Hakyll (Hakyll, Context)
3533import Text.Hakyll.Render (render, renderChain)
36−import Text.Hakyll.Renderables (createListingWith)
34+import Text.Hakyll.Renderables (createListing)
3735import Text.Hakyll.HakyllAction
3836
3937import Paths_hakyll
@@ -52,17 +50,16 @@ data FeedConfiguration = FeedConfiguration
5250
5351-- | This is an auxiliary function to create a listing that is, in fact, a feed.
5452-- The items should be sorted on date.
55−createFeedWith :: ContextManipulation -- ^ Manipulation to apply on the items.
56− -> FeedConfiguration -- ^ Feed configuration.
57− -> [Renderable] -- ^ Items to include.
58− -> FilePath -- ^ Feed template.
59− -> FilePath -- ^ Item template.
60− -> Renderable
61−createFeedWith manipulation configuration renderables template itemTemplate =
53+createFeed :: FeedConfiguration -- ^ Feed configuration.
54+ -> [HakyllAction () Context] -- ^ Items to include.
55+ -> FilePath -- ^ Feed template.
56+ -> FilePath -- ^ Item template.
57+ -> HakyllAction () Context
58+createFeed configuration renderables template itemTemplate =
6259 listing >>> render template
6360 where
64− listing = createListingWith manipulation (feedUrl configuration)
65− [itemTemplate] renderables additional
61+ listing = createListing (feedUrl configuration)
62+ [itemTemplate] renderables additional
6663
6764 additional = map (second $ Left . ($ configuration))
6865 [ ("title", feedTitle)
@@ -73,68 +70,41 @@ createFeedWith manipulation configuration renderables template itemTemplate =
7370 -- Take the first timestamp, which should be the most recent.
7471 updated = let action = createHakyllAction $
7572 return . fromMaybe "foo" . M.lookup "timestamp"
76− manip = createManipulationAction manipulation
77− toTuple r = ("timestamp", Right $ r >>> manip >>> action)
73+ toTuple r = ("timestamp", Right $ r >>> action)
7874 in map toTuple $ take 1 renderables
7975
8076
8177-- | Abstract function to render any feed.
82−renderFeedWith :: ContextManipulation -- ^ Manipulation to apply on the items.
83− -> FeedConfiguration -- ^ Feed configuration.
84− -> [Renderable] -- ^ Items to include in the feed.
85− -> FilePath -- ^ Feed template.
86− -> FilePath -- ^ Item template.
87− -> Hakyll ()
88−renderFeedWith manipulation configuration renderables template itemTemplate = do
78+renderFeed :: FeedConfiguration -- ^ Feed configuration.
79+ -> [HakyllAction () Context] -- ^ Items to include in the feed.
80+ -> FilePath -- ^ Feed template.
81+ -> FilePath -- ^ Item template.
82+ -> Hakyll ()
83+renderFeed configuration renderables template itemTemplate = do
8984 template' <- liftIO $ getDataFileName template
9085 itemTemplate' <- liftIO $ getDataFileName itemTemplate
91− let renderFeedWith' = createFeedWith manipulation configuration
92− renderables template' itemTemplate'
93− renderChain [] renderFeedWith'
86+ let renderFeed' = createFeed configuration renderables
87+ template' itemTemplate'
88+ renderChain [] renderFeed'
9489
9590-- | Render an RSS feed with a number of items.
96−renderRss :: FeedConfiguration -- ^ Feed configuration.
97− -> [Renderable] -- ^ Items to include in the RSS feed.
91+renderRss :: FeedConfiguration -- ^ Feed configuration.
92+ -> [HakyllAction () Context] -- ^ Items to include in the feed.
9893 -> Hakyll ()
99−renderRss = renderRssWith id
100−
101−-- | Render an RSS feed with a number of items. This function allows you to
102−-- specify a @ContextManipulation@ which will be applied on every
103−-- @Renderable@. Note that the given @Renderable@s should be sorted so the
104−-- most recent one is first.
105−renderRssWith :: ContextManipulation -- ^ Manipulation to apply on the items.
106− -> FeedConfiguration -- ^ Feed configuration.
107− -> [Renderable] -- ^ Items to include in the feed.
108− -> Hakyll ()
109−renderRssWith manipulation configuration renderables =
110− renderFeedWith manipulation' configuration renderables
111− "templates/rss.xml" "templates/rss-item.xml"
94+renderRss configuration renderables =
95+ renderFeed configuration (map (>>> renderRssDate) renderables)
96+ "templates/rss.xml" "templates/rss-item.xml"
11297 where
113− manipulation' = manipulation . renderRssDate
114−
115−-- | @ContextManipulation@ that renders a date to RSS format.
116−renderRssDate :: ContextManipulation
117−renderRssDate = renderDate "timestamp" "%a, %d %b %Y %H:%M:%S UT"
118− "No date found."
98+ renderRssDate = renderDate "timestamp" "%a, %d %b %Y %H:%M:%S UT"
99+ "No date found."
119100
120101-- | Render an Atom feed with a number of items.
121−renderAtom :: FeedConfiguration
122− -> [Renderable]
102+renderAtom :: FeedConfiguration -- ^ Feed configuration.
103+ -> [HakyllAction () Context] -- ^ Items to include in the feed.
123104 -> Hakyll ()
124−renderAtom = renderAtomWith id
125−
126−-- | A version of @renderAtom@ that allows you to specify a manipulation to
127−-- apply on the @Renderable@s.
128−renderAtomWith :: ContextManipulation -- ^ Manipulation to apply on the items.
129− -> FeedConfiguration -- ^ Feed configuration.
130− -> [Renderable] -- ^ Items to include in the feed.
131− -> Hakyll ()
132−renderAtomWith manipulation configuration renderables =
133− renderFeedWith manipulation' configuration renderables
134− "templates/atom.xml" "templates/atom-item.xml"
105+renderAtom configuration renderables =
106+ renderFeed configuration (map (>>> renderAtomDate) renderables)
107+ "templates/atom.xml" "templates/atom-item.xml"
135108 where
136− manipulation' = manipulation . renderAtomDate
137−
138−-- | Render a date to Atom format.
139−renderAtomDate :: ContextManipulation
140−renderAtomDate = renderDate "timestamp" "%Y-%m-%dT%H:%M:%SZ" "No date found."
109+ renderAtomDate = renderDate "timestamp" "%Y-%m-%dT%H:%M:%SZ"
110+ "No date found."
src/Text/Hakyll/Hakyll.hs+5−2
@@ -1,6 +1,7 @@
11-- | Module describing the Hakyll monad stack.
22module Text.Hakyll.Hakyll
3− ( HakyllConfiguration (..)
3+ ( Context
4+ , HakyllConfiguration (..)
45 , Hakyll
56 , askHakyll
67 , getAdditionalContext
@@ -8,9 +9,11 @@ module Text.Hakyll.Hakyll
89
910import Control.Monad.Reader (ReaderT, ask)
1011import Control.Monad (liftM)
12+import Data.Map (Map)
1113import qualified Data.Map as M
1214
13−import Text.Hakyll.Context (Context)
15+-- | Type for a context.
16+type Context = Map String String
1417
1518-- | Hakyll global configuration type.
1619data HakyllConfiguration = HakyllConfiguration
src/Text/Hakyll/HakyllAction.hs−12
@@ -4,11 +4,9 @@ module Text.Hakyll.HakyllAction
44 , createHakyllAction
55 , createSimpleHakyllAction
66 , createFileHakyllAction
7− , createManipulationAction
87 , chain
98 , runHakyllAction
109 , runHakyllActionIfNeeded
11− , Renderable
1210 ) where
1311
1412import Control.Arrow
@@ -18,7 +16,6 @@ import Control.Monad.Reader (liftIO)
1816import Prelude hiding ((.), id)
1917import System.IO (hPutStrLn, stderr)
2018
21−import Text.Hakyll.Context
2219import Text.Hakyll.File (toDestination, isFileMoreRecent)
2320import Text.Hakyll.Hakyll
2421
@@ -52,11 +49,6 @@ createFileHakyllAction path action = HakyllAction
5249 , actionFunction = const action
5350 }
5451
55−-- | Create a @HakyllAction@ from a @ContextManipulation@.
56−createManipulationAction :: ContextManipulation -- ^ Manipulation to apply.
57− -> HakyllAction Context Context
58−createManipulationAction = createHakyllAction . (return .)
59−
6052-- | Run a @HakyllAction@ now.
6153runHakyllAction :: HakyllAction () a -- ^ Render action to run.
6254 -> Hakyll a -- ^ Result of the action.
@@ -81,10 +73,6 @@ chain :: [HakyllAction a a] -- ^ Actions to chain.
8173chain [] = id
8274chain list@(_:_) = foldl1 (>>>) list
8375
84−-- | This is a specialized version of @HakyllAction@, a @Context@ that can be
85−-- rendered.
86−type Renderable = HakyllAction () Context
87−
8876instance Category HakyllAction where
8977 id = HakyllAction
9078 { actionDependencies = []
src/Text/Hakyll/Internal/Render.hs+6−11
@@ -1,9 +1,6 @@
11-- | Internal module do some low-level rendering.
22module Text.Hakyll.Internal.Render
3− ( substitute
4− , regularSubstitute
5− , finalSubstitute
6− , pureRenderWith
3+ ( pureRender
74 , writePage
85 ) where
96
@@ -11,21 +8,19 @@ import qualified Data.Map as M
118import Control.Monad.Reader (liftIO)
129import Data.Maybe (fromMaybe)
1310
14−import Text.Hakyll.Context (Context, ContextManipulation)
1511import Text.Hakyll.File
1612import Text.Hakyll.Hakyll
1713import Text.Hakyll.HakyllAction
1814import Text.Hakyll.Internal.Template
1915
2016-- | A pure render function.
21−pureRenderWith :: ContextManipulation -- ^ Manipulation to apply on the context.
22− -> Template -- ^ Template to use for rendering.
23− -> Context -- ^ Renderable object to render with given template.
24− -> Context -- ^ The body of the result will contain the render.
25−pureRenderWith manipulation template context =
17+pureRender :: Template -- ^ Template to use for rendering.
18+ -> Context -- ^ Renderable object to render with given template.
19+ -> Context -- ^ The body of the result will contain the render.
20+pureRender template context =
2621 -- Ignore $root when substituting here. We will only replace that in the
2722 -- final render (just before writing).
28− let contextIgnoringRoot = M.insert "root" "$root" (manipulation context)
23+ let contextIgnoringRoot = M.insert "root" "$root" context
2924 body = regularSubstitute template contextIgnoringRoot
3025 in M.insert "body" body context
3126
src/Text/Hakyll/Paginate.hs+3−2
@@ -7,6 +7,7 @@ module Text.Hakyll.Paginate
77
88import Control.Applicative ((<$>))
99
10+import Text.Hakyll.Hakyll (Context)
1011import Text.Hakyll.Renderables
1112import Text.Hakyll.HakyllAction
1213import Text.Hakyll.Util (link)
@@ -54,8 +55,8 @@ defaultPaginateConfiguration = PaginateConfiguration
5455-- without a link. The same goes for when we are on the first or last page for
5556-- @$first@ and @$last@.
5657paginate :: PaginateConfiguration
57− -> [Renderable]
58− -> [Renderable]
58+ -> [HakyllAction () Context]
59+ -> [HakyllAction () Context]
5960paginate configuration renderables = paginate' Nothing renderables (1 :: Int)
6061 where
6162 -- Create a link with a given label, taken from the configuration.
src/Text/Hakyll/Render.hs+13−41
@@ -2,11 +2,8 @@
22-- render files to the @_site@ directory.
33module Text.Hakyll.Render
44 ( render
5− , renderWith
65 , renderAndConcat
7− , renderAndConcatWith
86 , renderChain
9− , renderChainWith
107 , static
118 , css
129 ) where
@@ -17,8 +14,7 @@ import System.Directory (copyFile)
1714import Data.Maybe (fromMaybe)
1815import qualified Data.Map as M
1916
20−import Text.Hakyll.Hakyll (Hakyll)
21−import Text.Hakyll.Context (ContextManipulation, Context)
17+import Text.Hakyll.Hakyll (Hakyll, Context)
2218import Text.Hakyll.File
2319import Text.Hakyll.HakyllAction
2420import Text.Hakyll.Internal.CompressCss
@@ -28,14 +24,7 @@ import Text.Hakyll.Internal.Template (readTemplate)
2824-- | Render to a Page.
2925render :: FilePath -- ^ Template to use for rendering.
3026 -> HakyllAction Context Context -- ^ The render computation.
31−render = renderWith id
32−
33−-- | Render to a Page. This function allows you to manipulate the context
34−-- first.
35−renderWith :: ContextManipulation -- ^ Manipulation to apply first.
36− -> FilePath -- ^ Template to use for rendering.
37− -> HakyllAction Context Context -- ^ The render computation.
38−renderWith manipulation templatePath = HakyllAction
27+render templatePath = HakyllAction
3928 { actionDependencies = [templatePath]
4029 , actionUrl = Nothing
4130 , actionFunction = actionFunction'
@@ -43,7 +32,7 @@ renderWith manipulation templatePath = HakyllAction
4332 where
4433 actionFunction' context = do
4534 template <- readTemplate templatePath
46− return $ pureRenderWith manipulation template context
35+ return $ pureRender template context
4736
4837-- | Render each renderable with the given templates, then concatenate the
4938-- result. So, basically this function:
@@ -55,27 +44,17 @@ renderWith manipulation templatePath = HakyllAction
5544--
5645-- * Concatenates the result.
5746--
58−renderAndConcat :: [FilePath] -- ^ Templates to apply on every renderable.
59− -> [Renderable] -- ^ Renderables to render.
47+renderAndConcat :: [FilePath]
48+ -> [HakyllAction () Context]
6049 -> HakyllAction () String
61−renderAndConcat = renderAndConcatWith id
62−
63−-- | Render each renderable with the given templates, then concatenate the
64−-- result. This function allows you to specify a @ContextManipulation@ to
65−-- apply on every @Renderable@.
66−renderAndConcatWith :: ContextManipulation
67− -> [FilePath]
68− -> [Renderable]
69− -> HakyllAction () String
70−renderAndConcatWith manipulation templatePaths renderables = HakyllAction
50+renderAndConcat templatePaths renderables = HakyllAction
7151 { actionDependencies = renders >>= actionDependencies
72− , actionUrl = Nothing
52+ , actionUrl = Nothing
7353 , actionFunction = actionFunction'
7454 }
7555 where
7656 render' = chain (map render templatePaths)
77− renders = map (>>> manipulationAction >>> render') renderables
78− manipulationAction = createManipulationAction manipulation
57+ renders = map (>>> render') renderables
7958
8059 actionFunction' _ = do
8160 contexts <- mapM runHakyllAction renders
@@ -91,23 +70,16 @@ renderAndConcatWith manipulation templatePaths renderables = HakyllAction
9170--
9271-- This code will first render @warning.html@ using @templates/notice.html@,
9372-- and will then render the result with @templates/default.html@.
94−renderChain :: [FilePath] -> Renderable -> Hakyll ()
95−renderChain = renderChainWith id
96−
97−-- | A more custom render chain that allows you to specify a
98−-- @ContextManipulation@ which to apply on the context when it is read first.
99−renderChainWith :: ContextManipulation
100− -> [FilePath]
101− -> Renderable
102− -> Hakyll ()
103−renderChainWith manipulation templatePaths initial =
73+renderChain :: [FilePath]
74+ -> HakyllAction () Context
75+ -> Hakyll ()
76+renderChain templatePaths initial =
10477 runHakyllActionIfNeeded renderChainWith'
10578 where
10679 renderChainWith' :: HakyllAction () ()
107− renderChainWith' = initial >>> manipulationAction >>> chain' >>> writePage
80+ renderChainWith' = initial >>> chain' >>> writePage
10881
10982 chain' = chain (map render templatePaths)
110− manipulationAction = createManipulationAction manipulation
11183
11284
11385-- | Mark a certain file as static, so it will just be copied when the site is
src/Text/Hakyll/Renderables.hs+15−28
@@ -1,7 +1,6 @@
11module Text.Hakyll.Renderables
22 ( createCustomPage
33 , createListing
4− , createListingWith
54 , createPagePath
65 , combine
76 , combineWithUrl
@@ -27,7 +26,7 @@ import Text.Hakyll.Internal.Page
2726-- cases.
2827createCustomPage :: String
2928 -> [(String, Either String (HakyllAction () String))]
30− -> Renderable
29+ -> HakyllAction () Context
3130createCustomPage url association = HakyllAction
3231 { actionDependencies = dataDependencies
3332 , actionUrl = Just $ return url
@@ -43,42 +42,30 @@ createCustomPage url association = HakyllAction
4342
4443-- | A @createCustomPage@ function specialized in creating listings.
4544--
46−-- This function creates a listing of a certain list of @Renderable@s. Every
45+-- This function creates a listing of a certain list of renderables. Every
4746-- item in the list is created by applying the given template to every
4847-- renderable. You can also specify additional context to be included in the
4948-- @CustomPage@.
5049--
51−-- > let customPage = createListingWith
50+-- > let customPage = createListing
5251-- > "index.html" -- Destination of the page.
5352-- > ["templates/postitem.html"] -- Paths to templates to render the
5453-- > -- items with.
5554-- > posts -- Renderables to create the list with.
5655-- > [("title", Left "Home")] -- Additional context
57−createListing :: String -- ^ Destination of the page.
58− -> [FilePath] -- ^ Templates to render all items with.
59− -> [Renderable] -- ^ Renderables in the list.
56+createListing :: String -- ^ Destination of the page.
57+ -> [FilePath] -- ^ Templates to render items with.
58+ -> [HakyllAction () Context] -- ^ Renderables in the list.
6059 -> [(String, Either String (HakyllAction () String))]
61− -> Renderable
62−createListing = createListingWith id
63−
64−-- | A @createCustomPage@ function specialized in creating listings.
65−--
66−-- In addition to @createListing@, this function allows you to specify an
67−-- extra @ContextManipulation@ for all @Renderable@s given.
68−createListingWith :: ContextManipulation -- ^ Manipulation for the renderables.
69− -> String -- ^ Destination of the page.
70− -> [FilePath] -- ^ Templates to render all items with.
71− -> [Renderable] -- ^ Renderables in the list.
72− -> [(String, Either String (HakyllAction () String))]
73− -> Renderable
74−createListingWith manipulation url templates renderables additional =
60+ -> HakyllAction () Context
61+createListing url templates renderables additional =
7562 createCustomPage url context
7663 where
7764 context = ("body", Right concatenation) : additional
78− concatenation = renderAndConcatWith manipulation templates renderables
65+ concatenation = renderAndConcat templates renderables
7966
8067-- | Create a PagePath from a FilePath.
81−createPagePath :: FilePath -> Renderable
68+createPagePath :: FilePath -> HakyllAction () Context
8269createPagePath path = HakyllAction
8370 { actionDependencies = [path]
8471 , actionUrl = Just $ toUrl path
@@ -91,8 +78,8 @@ createPagePath path = HakyllAction
9178--
9279-- Since renderables are always more or less key-value maps, you can see
9380-- this as a @union@ between two maps.
94−combine :: Renderable -> Renderable
95− -> Renderable
81+combine :: HakyllAction () Context -> HakyllAction () Context
82+ -> HakyllAction () Context
9683combine x y = HakyllAction
9784 { actionDependencies = actionDependencies x ++ actionDependencies y
9885 , actionUrl = actionUrl x `mplus` actionUrl y
@@ -103,9 +90,9 @@ combine x y = HakyllAction
10390-- | Combine two renderables and set a custom URL. This behaves like @combine@,
10491-- except that for the @url@ field, the given URL is always chosen.
10592combineWithUrl :: FilePath
106− -> Renderable
107− -> Renderable
108− -> Renderable
93+ -> HakyllAction () Context
94+ -> HakyllAction () Context
95+ -> HakyllAction () Context
10996combineWithUrl url x y = combine'
11097 { actionUrl = Just $ return url
11198 , actionFunction = \_ ->
src/Text/Hakyll/Tags.hs+3−3
@@ -58,7 +58,7 @@ import Text.Hakyll.Internal.Template
5858-- This is a map associating tags or categories to the appropriate pages
5959-- using that tag or category. In the case of categories, each path will only
6060-- appear under one category - this is not the case with tags.
61−type TagMap = M.Map String [Renderable]
61+type TagMap = M.Map String [HakyllAction () Context]
6262
6363-- | Read a tag map. This is a internally used function that can be used for
6464-- tags as well as for categories.
@@ -106,7 +106,7 @@ readCategoryMap :: String -- ^ Unique identifier for the map.
106106readCategoryMap = readMap $ maybeToList . M.lookup "category"
107107
108108withTagMap :: HakyllAction () TagMap
109− -> (String -> [Renderable] -> Hakyll ())
109+ -> (String -> [HakyllAction () Context] -> Hakyll ())
110110 -> Hakyll ()
111111withTagMap tagMap function = runHakyllAction (tagMap >>> action)
112112 where
@@ -154,7 +154,7 @@ renderTagCloud urlFunction minSize maxSize = createHakyllAction renderTagCloud'
154154-- Note that it is your own responsibility to ensure a page with such an url
155155-- exists.
156156renderTagLinks :: (String -> String) -- ^ Function to produce an url for a tag.
157− -> ContextManipulation
157+ -> HakyllAction Context Context
158158renderTagLinks urlFunction = changeValue "tags" renderTagLinks'
159159 where
160160 renderTagLinks' = intercalate ", "