diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-04-22 20:24:19 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-04-22 20:24:19 +0200 |
commit | 2895a05a19f7cf53437d609e74ebce28c8c9be29 (patch) | |
tree | bbeda30ae63d22c9b1f58e1e369212d746d6f256 /src/Hakyll | |
parent | 79215f71eb501f65d3e74fdda3e592fbcadd9c7e (diff) | |
download | hakyll-2895a05a19f7cf53437d609e74ebce28c8c9be29.tar.gz |
Micro cleanup
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Check.hs | 6 | ||||
-rw-r--r-- | src/Hakyll/Web/Tags.hs | 18 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/Hakyll/Check.hs b/src/Hakyll/Check.hs index 68ece18..d48f996 100644 --- a/src/Hakyll/Check.hs +++ b/src/Hakyll/Check.hs @@ -198,13 +198,13 @@ checkExternalUrl url = do else do isOk <- liftIO $ handle (failure logger) $ Http.withManager $ \mgr -> do - request <- Http.parseUrl $ urlToCheck url + request <- Http.parseUrl urlToCheck response <- Http.http (settings request) mgr let code = Http.statusCode (Http.responseStatus response) return $ code >= 200 && code < 300 modify $ if schemeRelative url - then S.insert (urlToCheck url) . S.insert url + then S.insert urlToCheck . S.insert url else S.insert url if isOk then ok url else faulty url where @@ -226,7 +226,7 @@ checkExternalUrl url = do -- Check scheme-relative links schemeRelative = isPrefixOf "//" - urlToCheck uri = if schemeRelative uri then "http:" ++ uri else uri + urlToCheck = if schemeRelative url then "http:" ++ url else url #else checkExternalUrl _ = return () #endif diff --git a/src/Hakyll/Web/Tags.hs b/src/Hakyll/Web/Tags.hs index 0bca696..bfa83e6 100644 --- a/src/Hakyll/Web/Tags.hs +++ b/src/Hakyll/Web/Tags.hs @@ -198,17 +198,15 @@ renderTagCloud :: Double -- ^ Rendered cloud renderTagCloud = renderTagCloudWith makeLink (intercalate " ") where - makeLink minSize maxSize tag url count min' max' = renderHtml $ - H.a ! A.style (toValue $ "font-size: " ++ size count min' max') - ! A.href (toValue url) - $ toHtml tag - where + makeLink minSize maxSize tag url count min' max' = -- Show the relative size of one 'count' in percent - size count min' max' = - let diff = 1 + fromIntegral max' - fromIntegral min' - relative = (fromIntegral count - fromIntegral min') / diff - size' = floor $ minSize + relative * (maxSize - minSize) - in show (size' :: Int) ++ "%" + let diff = 1 + fromIntegral max' - fromIntegral min' + relative = (fromIntegral count - fromIntegral min') / diff + size = floor $ minSize + relative * (maxSize - minSize) :: Int + in renderHtml $ + H.a ! A.style (toValue $ "font-size: " ++ show size ++ "%") + ! A.href (toValue url) + $ toHtml tag -------------------------------------------------------------------------------- |