From b403d35b087683a7a38e57b943c63449613b3115 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 8 Jan 2010 12:04:24 +0100 Subject: Added renderTagLinks function. --- src/Text/Hakyll/Tags.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Hakyll/Tags.hs b/src/Text/Hakyll/Tags.hs index 9cd8abd..c64d566 100644 --- a/src/Text/Hakyll/Tags.hs +++ b/src/Text/Hakyll/Tags.hs @@ -1,14 +1,17 @@ -- | Module containing some specialized functions to deal with tags. +-- This Module follows certain conventions. Stick with them. module Text.Hakyll.Tags ( readTagMap , renderTagCloud + , renderTagLinks ) where import qualified Data.Map as M import qualified Data.ByteString.Lazy.Char8 as B -import qualified Data.List as L +import Data.List (intercalate) import Control.Monad (foldM) +import Text.Hakyll.Context (ContextManipulation, renderValue) import Text.Hakyll.Util import Text.Hakyll.Page import Control.Arrow (second) @@ -30,7 +33,7 @@ renderTagCloud :: M.Map String [FilePath] -- ^ A tag map as produced by 'readTag -> Float -- ^ Biggest font size, in percent. -> String -- ^ Result of the render. renderTagCloud tagMap urlFunction minSize maxSize = - L.intercalate " " $ map renderTag tagCount + intercalate " " $ map renderTag tagCount where renderTag :: (String, Float) -> String renderTag (tag, count) = " String) -- ^ Function that produces an url for a tag. + -> ContextManipulation +renderTagLinks urlFunction = renderValue "tags" "tags" renderTagLinks' + where renderTagLinks' = B.pack . intercalate ", " . map urlFunction + . map trim . split "," . B.unpack -- cgit v1.2.3