Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/sponsors/juspay/juspay-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sponsors/juspay/juspay-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sponsors/juspay/juspay-683.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sponsors/mercury/mercury-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sponsors/mercury/mercury-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sponsors/mercury/mercury-683.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/sponsors/mercury/mercury.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added assets/images/sponsors/tripshot/tripshot-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sponsors/tripshot/tripshot-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sponsors/tripshot/tripshot-683.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion donations/sponsors/juspay.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Juspay
logo: /assets/images/sponsors/juspay/juspay_logo.png
logo: /assets/images/sponsors/juspay/juspay-683.png
srcset: /assets/images/sponsors/juspay/juspay-200.png 200w, /assets/images/sponsors/juspay/juspay-400.png 400w, /assets/images/sponsors/juspay/juspay-683.png 683w
externalUrl: https://juspay.in
level: Gold
careersUrl: https://juspay.in/careers
Expand Down
3 changes: 2 additions & 1 deletion donations/sponsors/mercury.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Mercury
logo: /assets/images/sponsors/mercury/mercury.png
logo: /assets/images/sponsors/mercury/mercury-683.png
srcset: /assets/images/sponsors/mercury/mercury-200.png 200w, /assets/images/sponsors/mercury/mercury-400.png 400w, /assets/images/sponsors/mercury/mercury-683.png 683w
externalUrl: https://mercury.com/
level: Gold
careersUrl: https://mercury.com/jobs
Expand Down
3 changes: 2 additions & 1 deletion donations/sponsors/standard-chartered.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Standard Chartered
logo: /assets/images/sponsors/standard-chartered/scb-logo.png
logo: /assets/images/sponsors/standard-chartered/scb-683.png
srcset: /assets/images/sponsors/standard-chartered/scb-200.png 200w, /assets/images/sponsors/standard-chartered/scb-400.png 400w, /assets/images/sponsors/standard-chartered/scb-683.png 683w
externalUrl: https://www.sc.com/en/
level: Gold
careersUrl: https://www.sc.com/en/global-careers/
Expand Down
3 changes: 2 additions & 1 deletion donations/sponsors/tripshot.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: TripShot
logo: /assets/images/sponsors/tripshot/Tripshot_Logo_RGB.png
logo: /assets/images/sponsors/tripshot/tripshot-683.png
srcset: /assets/images/sponsors/tripshot/tripshot-200.png 200w, /assets/images/sponsors/tripshot/tripshot-400.png 400w, /assets/images/sponsors/tripshot/tripshot-683.png 683w
externalUrl: https://tripshot.com/
level: Bronze
careersUrl: https://tripshot.com/careers
Expand Down
1 change: 1 addition & 0 deletions haskell-foundation.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cabal-version: 2.0
executable site
main-is: site.hs
build-depends: base == 4.*
, bytestring
, hakyll ^>= 4.14 || ^>= 4.15 || ^>= 4.16
, monadlist
, pandoc >=2.11 && <3.8
Expand Down
43 changes: 39 additions & 4 deletions site.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import Control.Monad (filterM, guard)
import Control.Monad.ListM (sortByM)
import qualified Data.ByteString as BS
import Data.List (sortOn, isPrefixOf)
import Data.Maybe (fromMaybe, isJust)
import Data.Ord (Down (..))
Expand All @@ -28,6 +29,7 @@ import Text.Pandoc as Pandoc (
runPure,
writePlain,
)
import Text.Pandoc.ImageSize (ImageSize (pxX, pxY), imageSize)

import Debug.Trace (trace)

Expand Down Expand Up @@ -102,6 +104,7 @@ main = hakyllWith config $ do

-- sponsors --------------------------------------------------------------------------------------------
match "donations/sponsors/*.markdown" $ compile pandocCompiler
match "assets/images/sponsors/**" $ version logoBytes $ compile getResourceLBS

-- in-kind donations -----------------------------------------------------------------------------------
create ["donations/index.html"] $ do
Expand Down Expand Up @@ -508,9 +511,9 @@ or use the passed in Maybe title, if it is a Just, or "No title" if not.
boilerPlateCtx :: Maybe String -> [Item String] -> Context String
boilerPlateCtx mtitle sponsors =
mconcat
[ listField "golds" defaultContext (ofMetadataField "level" "Gold" sponsors)
, listField "silvers" defaultContext (ofMetadataField "level" "Silver" sponsors)
, listField "bronzes" defaultContext (ofMetadataField "level" "Bronze" sponsors)
[ listField "golds" sponsorCtx (ofMetadataField "level" "Gold" sponsors)
, listField "silvers" sponsorCtx (ofMetadataField "level" "Silver" sponsors)
, listField "bronzes" sponsorCtx (ofMetadataField "level" "Bronze" sponsors)
, field "title" $ \item -> do
metadata <- getMetadata (itemIdentifier item)
return $ fromMaybe (fromMaybe "No title" mtitle) $ lookupString "title" metadata
Expand All @@ -520,6 +523,38 @@ boilerPlateCtx mtitle sponsors =
, defaultContext
]

-- | A single sponsor, as rendered in a logo row.
sponsorCtx :: Context String
sponsorCtx =
field "logoWidth" (fmap (show . pxX) . logoSize)
<> field "logoHeight" (fmap (show . pxY) . logoSize)
<> defaultContext

{- | Browsers decode an image at its full size however small it is shown, and
the footer puts every logo on every page. Export logos at 683 px wide, plus 200
and 400 px for the @srcset@.
-}
maxLogoWidth :: Integer
maxLogoWidth = 1000

-- | The version of a sponsor image whose body is the file's contents, for
-- 'logoSize' to 'load'.
logoBytes :: String
logoBytes = "bytes"

-- | Intrinsic size of the file the @logo@ URL names, which must lie under
-- @assets/images/sponsors/@. Fails the build if the format is unknown or the
-- image is wider than 'maxLogoWidth'.
logoSize :: Item a -> Compiler ImageSize
logoSize item = do
path <- dropWhile (== '/') <$> getMetadataField' (itemIdentifier item) "logo"
image <- BS.toStrict <$> loadBody (setVersion (Just logoBytes) (fromFilePath path))
either (fail . ((path <> ": ") <>)) pure $ do
size <- either (Left . T.unpack) Right (imageSize defaultHakyllWriterOptions image)
if pxX size > maxLogoWidth
then Left $ show (pxX size) <> " px wide, more than " <> show maxLogoWidth <> " px"
else Right size

-- affiliates ------------------------------------------------------------------------------------------

-- | Partition affiliates into affiliates and pending
Expand Down Expand Up @@ -612,7 +647,7 @@ careersCtx reqs =

hiringSponsorsCtx :: [Item String] -> Context String
hiringSponsorsCtx sponsors =
listField "hiringsponsors" defaultContext (filterMetadataField "careersUrl" sponsors)
listField "hiringsponsors" sponsorCtx (filterMetadataField "careersUrl" sponsors)
<> defaultContext

-- Anouncements
Expand Down
2 changes: 1 addition & 1 deletion templates/careers/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h2 class="text-gray-50 font-normal text-3xl md:text-4xl text-center">Haskell Fo
<div class="mt-16 md:mt-24">
<div class="max-w-screen-xl mx-auto grid gap-8 lg:grid-cols-2 md:px-12">
$for(hiringsponsors)$
<a href="$careersUrl$" target="_blank" class="block w-36 m-4"><img alt="$title$" src="$logo$" $if(srcset)$ srcset="$srcset$" $endif$></a>
<a href="$careersUrl$" target="_blank" class="block w-36 m-4"><img alt="$title$" src="$logo$" width="$logoWidth$" height="$logoHeight$" $if(srcset)$ srcset="$srcset$" sizes="9rem" $endif$></a>
$endfor$
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
<div class="flex flex-wrap items-center justify-center">
$for(golds)$
<a href="$externalUrl$" target="_blank" class="block w-48 m-4"><img alt="$title$" src="$logo$" $if(srcset)$ srcset="$srcset$" $endif$></a>
<a href="$externalUrl$" target="_blank" class="block w-48 m-4"><img alt="$title$" src="$logo$" width="$logoWidth$" height="$logoHeight$" $if(srcset)$ srcset="$srcset$" sizes="12rem" $endif$></a>
$endfor$
</div>

Expand All @@ -15,7 +15,7 @@
</div>
<div class="flex flex-wrap items-center justify-center">
$for(silvers)$
<a href="$externalUrl$" target="_blank" class="block w-36 m-4"><img alt="$title$" src="$logo$" $if(srcset)$ srcset="$srcset$" $endif$></a>
<a href="$externalUrl$" target="_blank" class="block w-36 m-4"><img alt="$title$" src="$logo$" width="$logoWidth$" height="$logoHeight$" $if(srcset)$ srcset="$srcset$" sizes="9rem" $endif$></a>
$endfor$
</div>

Expand All @@ -24,7 +24,7 @@
</div>
<div class="flex flex-wrap items-center justify-center">
$for(bronzes)$
<a href="$externalUrl$" target="_blank" class="block w-24 m-4"><img alt="$title$" src="$logo$" $if(srcset)$ srcset="$srcset$" $endif$></a>
<a href="$externalUrl$" target="_blank" class="block w-24 m-4"><img alt="$title$" src="$logo$" width="$logoWidth$" height="$logoHeight$" $if(srcset)$ srcset="$srcset$" sizes="6rem" $endif$></a>
$endfor$
</div>
</div>
Expand Down
Loading