summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-04 21:57:28 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-04 21:57:28 +0200
commit8b5347eb26c28bc3d4b80230df488c8ae959c47c (patch)
treed9a4e201a323a660653d5212af7b11fb27c3ebb2 /src
parentc8588f13c8b5977723af3660ff87256b744f0643 (diff)
downloadhakyll-8b5347eb26c28bc3d4b80230df488c8ae959c47c.tar.gz
Assoc. list-based implementation of tags
Goal is to be able to sort them later (see gh-22)
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Web/Tags.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Hakyll/Web/Tags.hs b/src/Hakyll/Web/Tags.hs
index c971b0f..32076a0 100644
--- a/src/Hakyll/Web/Tags.hs
+++ b/src/Hakyll/Web/Tags.hs
@@ -40,7 +40,6 @@ module Hakyll.Web.Tags
import Prelude hiding (id)
import Control.Category (id)
import Control.Applicative ((<$>))
-import Data.Map (Map)
import qualified Data.Map as M
import Data.List (intersperse, intercalate)
import Control.Arrow (arr, (&&&), (>>>), (***), (<<^), returnA)
@@ -65,7 +64,7 @@ import Hakyll.Core.Util.String
-- | Data about tags
--
data Tags a = Tags
- { tagsMap :: Map String [Page a]
+ { tagsMap :: [(String, [Page a])]
} deriving (Show, Typeable)
instance Binary a => Binary (Tags a) where
@@ -91,7 +90,8 @@ readTagsWith :: (Page a -> [String]) -- ^ Function extracting tags from a page
-> [Page a] -- ^ Pages
-> Tags a -- ^ Resulting tags
readTagsWith f pages = Tags
- { tagsMap = foldl (M.unionWith (++)) M.empty (map readTagsWith' pages)
+ { tagsMap = M.toList $
+ foldl (M.unionWith (++)) M.empty (map readTagsWith' pages)
}
where
-- Create a tag map for one page
@@ -122,7 +122,7 @@ renderTags :: (String -> Identifier)
renderTags makeUrl makeItem concatItems = proc (Tags tags) -> do
-- In tags' we create a list: [((tag, route), count)]
tags' <- mapCompiler ((id &&& (getRouteFor <<^ makeUrl)) *** arr length)
- -< M.toList tags
+ -< tags
let -- Absolute frequencies of the pages
freqs = map snd tags'