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.
commit6d81544fb3047914f8eea5245492daecd3b36c53
authorDaniel Ehlers <danielehlers@mindeye.net>
dateSun 6 Feb 2011, 20:41 (16 years ago)
parent7348e1c
src/Text/Hakyll/Tags.hs+1−1
@@ -149,7 +149,7 @@ renderTagCloud urlFunction minSize maxSize = createHakyllAction renderTagCloud'
149149 minCount = minimum . map snd . tagCount
150150 maxCount = maximum . map snd . tagCount
151151 relative tagMap count = (count - minCount tagMap) /
152− (maxCount tagMap - minCount tagMap)
152+ (1 + maxCount tagMap - minCount tagMap)
153153
154154 tagCount = map (second $ fromIntegral . length) . M.toList
155155