Skip to content

Commit e3f0c8e

Browse files
committed
Port of interim, current, past board, and exec team.
1 parent 1e7c512 commit e3f0c8e

26 files changed

+494
-558
lines changed

site.hs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{-# Language ScopedTypeVariables #-}
22
{-# Language OverloadedStrings #-}
33
{-# Language ViewPatterns #-}
4+
{-# Language BangPatterns #-}
45

56
import Hakyll
67
import Data.List (sortOn)
78
import Control.Monad (filterM)
89
import Control.Monad.ListM (sortByM)
910
import Hakyll.Web.Template (loadAndApplyTemplate)
11+
import System.IO (SeekMode(RelativeSeek))
12+
import Hakyll.Web.Html.RelativizeUrls (relativizeUrls)
13+
import Hakyll.Web.Template.Context (defaultContext)
14+
import Data.Maybe (isJust)
1015

1116
--------------------------------------------------------------------------------------------------------
1217
-- MAIN GENERATION -------------------------------------------------------------------------------------
@@ -111,6 +116,30 @@ main = hakyll $ do
111116
>>= loadAndApplyTemplate "templates/boilerplate.html" sponsors
112117
>>= relativizeUrls
113118

119+
-- who we are ------------------------------------------------------------------------------------------
120+
match "who-we-are/people/*.markdown" $ compile pandocCompiler
121+
create ["who-we-are/index.html"] $ do
122+
route idRoute
123+
compile $ do
124+
sponsors <- buildSponsorsCtx
125+
ctx <- whoWeAreCtx <$> loadAll "who-we-are/people/*.markdown"
126+
127+
makeItem ""
128+
>>= loadAndApplyTemplate "templates/who-we-are/exec-and-board.html" ctx
129+
>>= loadAndApplyTemplate "templates/boilerplate.html" sponsors
130+
>>= relativizeUrls
131+
132+
create ["who-we-are/past-boards/index.html"] $ do
133+
route idRoute
134+
compile $ do
135+
sponsors <- buildSponsorsCtx
136+
ctx <- whoWeAreCtx <$> loadAll "who-we-are/people/*.markdown"
137+
138+
makeItem ""
139+
>>= loadAndApplyTemplate "templates/who-we-are/past-board.html" ctx
140+
>>= loadAndApplyTemplate "templates/boilerplate.html" sponsors
141+
>>= relativizeUrls
142+
114143
-- general 'static' pages ------------------------------------------------------------------------------
115144
match ("index.html" .||. "**/index.html") $ do
116145
route idRoute
@@ -212,6 +241,27 @@ faqCtx entries =
212241
listField "faq_entries" defaultContext (sortFromMetadataField "order" entries) <>
213242
defaultContext
214243

244+
-- who we are ------------------------------------------------------------------------------------------
245+
whoWeAreCtx :: [Item String] -> Context String
246+
whoWeAreCtx people =
247+
listField "currentexecutiveteam" defaultContext (ofMetadataFieldCurrent True "executiveTeam" "True" people) <>
248+
listField "currentboard" defaultContext (ofMetadataFieldCurrent True "executiveTeam" "False" people) <>
249+
listField "pastexecutiveteam" defaultContext (ofMetadataFieldCurrent False "executiveTeam" "True" people) <>
250+
listField "pastboard" defaultContext (ofMetadataFieldCurrent False "executiveTeam" "False" people) <>
251+
listField "interimboard" defaultContext (ofMetadataField "interimBoard" "True" people) <>
252+
defaultContext
253+
where
254+
ofMetadataFieldCurrent :: Bool -> String -> String -> [Item String] -> Compiler [Item String]
255+
ofMetadataFieldCurrent cur field value items = do
256+
items' <- ofMetadataField field value items
257+
filterM (\item -> do
258+
mbTenureStart <- getMetadataField (itemIdentifier item) "tenureStart"
259+
mbTenureStop <- getMetadataField (itemIdentifier item) "tenureEnd"
260+
pure $ case mbTenureStop of
261+
Nothing -> cur && isJust mbTenureStart
262+
Just date -> not cur
263+
) items'
264+
215265
--------------------------------------------------------------------------------------------------------
216266
-- UTILS -----------------------------------------------------------------------------------------------
217267
--------------------------------------------------------------------------------------------------------

site/who-we-are/index.html

Lines changed: 0 additions & 405 deletions
This file was deleted.

site/who-we-are/past-boards/index.html

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)