@@ -27,6 +27,7 @@
2727-- @readTagMap@ or @readCategoryMap@ function, you also have to give a unique
2828-- identifier to it. This identifier is simply for caching reasons, so Hakyll
2929-- can tell different maps apart; it has no other use.
30+--
3031module Text.Hakyll.Tags
3132 ( TagMap
3233 , readTagMap
@@ -40,9 +41,15 @@ import qualified Data.Map as M
4041import Data.List (intercalate)
4142import Data.Maybe (fromMaybe, maybeToList)
4243import Control.Arrow (second, (>>>))
44+import Data.Monoid (mappend)
4345import Control.Applicative ((<$>))
4446import System.FilePath
4547
48+import Text.Blaze.Renderer.String (renderHtml)
49+import Text.Blaze.Html5 ((!), string, stringValue)
50+import qualified Text.Blaze.Html5 as H
51+import qualified Text.Blaze.Html5.Attributes as A
52+
4653import Text.Hakyll.Context (Context (..))
4754import Text.Hakyll.ContextManipulations (changeValue)
4855import Text.Hakyll.CreateContext (createPage)
@@ -130,16 +137,11 @@ renderTagCloud urlFunction minSize maxSize = createHakyllAction renderTagCloud'
130137 renderTagCloud' tagMap =
131138 return $ intercalate " " $ map (renderTag tagMap) (tagCount tagMap)
132139
133− renderTag tagMap (tag, count) =
134− finalSubstitute linkTemplate $ Context $ M.fromList
135− [ ("size", sizeTag tagMap count)
136− , ("url", urlFunction tag)
137− , ("tag", tag)
138− ]
139−
140− linkTemplate =
141− fromString "<a style=\"font-size: $size\" href=\"$url\">$tag</a>"
142−
140+ renderTag tagMap (tag, count) = renderHtml $
141+ H.a ! A.style (stringValue $ "font-size: " ++ sizeTag tagMap count)
142+ ! A.href (stringValue $ urlFunction tag)
143+ $ string tag
144+
143145 sizeTag tagMap count = show (size' :: Int) ++ "%"
144146 where
145147 size' = floor $ minSize + relative tagMap count * (maxSize - minSize)