From 6d81544fb3047914f8eea5245492daecd3b36c53 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Sun, 6 Feb 2011 20:41:21 +0100 Subject: Fix possible division by zero. When 'maxCount' and 'minCount' are equal then 'relative' will return NaN. Which result in font-size 0 on all tags in the tag cloud. --- src/Text/Hakyll/Tags.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Hakyll/Tags.hs b/src/Text/Hakyll/Tags.hs index a4559ca..d427aa5 100644 --- a/src/Text/Hakyll/Tags.hs +++ b/src/Text/Hakyll/Tags.hs @@ -149,7 +149,7 @@ renderTagCloud urlFunction minSize maxSize = createHakyllAction renderTagCloud' minCount = minimum . map snd . tagCount maxCount = maximum . map snd . tagCount relative tagMap count = (count - minCount tagMap) / - (maxCount tagMap - minCount tagMap) + (1 + maxCount tagMap - minCount tagMap) tagCount = map (second $ fromIntegral . length) . M.toList -- cgit v1.2.3