@@ -75,6 +75,7 @@ import qualified Text.Blaze.Html5.Attributes as A
76--------------------------------------------------------------------------------
76--------------------------------------------------------------------------------
77import Hakyll.Core.Compiler
77import Hakyll.Core.Compiler
78+import Hakyll.Core.Dependencies
78import Hakyll.Core.Identifier
79import Hakyll.Core.Identifier
79import Hakyll.Core.Identifier.Pattern
80import Hakyll.Core.Identifier.Pattern
80import Hakyll.Core.Item
81import Hakyll.Core.Item
@@ -88,8 +89,9 @@ import Hakyll.Web.Urls
88--------------------------------------------------------------------------------
89--------------------------------------------------------------------------------
89-- | Data about tags
90-- | Data about tags
90data Tags = Tags
91data Tags = Tags
91− { tagsMap :: [(String, [Identifier])]
92+ { tagsMap :: [(String, [Identifier])]
92− , tagsMakeId :: String -> Identifier
93+ , tagsMakeId :: String -> Identifier
94+ , tagsDependency :: Dependency
93 } deriving (Show)
95 } deriving (Show)
@@ -117,7 +119,7 @@ buildTagsWith :: MonadMetadata m
117buildTagsWith f pattern makeId = do
119buildTagsWith f pattern makeId = do
118 ids <- getMatches pattern
120 ids <- getMatches pattern
119 tagMap <- foldM addTags M.empty ids
121 tagMap <- foldM addTags M.empty ids
120− return $ Tags (M.toList tagMap) makeId
122+ return $ Tags (M.toList tagMap) makeId (PatternDependency pattern ids)
122 -- Create a tag map for one page
124 -- Create a tag map for one page
123 addTags tagMap id' = do
125 addTags tagMap id' = do
@@ -142,7 +144,8 @@ tagsRules :: Tags -> (String -> Pattern -> Rules ()) -> Rules ()
142tagsRules tags rules =
144tagsRules tags rules =
143 forM_ (tagsMap tags) $ \(tag, identifiers) ->
145 forM_ (tagsMap tags) $ \(tag, identifiers) ->
144 match (fromGlob $ toFilePath $ tagsMakeId tags tag) $
146 match (fromGlob $ toFilePath $ tagsMakeId tags tag) $
147+ rulesExtraDependencies [tagsDependency tags] $
145− rules tag $ fromList identifiers
148+ rules tag $ fromList identifiers
148--------------------------------------------------------------------------------
151--------------------------------------------------------------------------------
@@ -154,10 +157,10 @@ renderTags :: (String -> String -> Int -> Int -> Int -> String)
155 -- ^ Tag cloud renderer
158 -- ^ Tag cloud renderer
156 -> Compiler String
159 -> Compiler String
157−renderTags makeHtml concatHtml (Tags tags makeTagId) = do
160+renderTags makeHtml concatHtml tags = do
158 -- In tags' we create a list: [((tag, route), count)]
161 -- In tags' we create a list: [((tag, route), count)]
159− tags' <- forM tags $ \(tag, ids) -> do
162+ tags' <- forM (tagsMap tags) $ \(tag, ids) -> do
160− route' <- getRoute $ makeTagId tag
163+ route' <- getRoute $ tagsMakeId tags tag
161 return ((tag, route'), length ids)
164 return ((tag, route'), length ids)
163 -- TODO: We actually need to tell a dependency here!
166 -- TODO: We actually need to tell a dependency here!